Revision 4c8b82e2 include/VirtualNetworkTemplate.h
include/VirtualNetworkTemplate.h | ||
---|---|---|
27 | 27 |
class VirtualNetworkTemplate : public Template |
28 | 28 |
{ |
29 | 29 |
public: |
30 |
VirtualNetworkTemplate(): |
|
31 |
Template(false,'=',"TEMPLATE"){}; |
|
30 |
VirtualNetworkTemplate():Template(false,'=',"TEMPLATE"){}; |
|
32 | 31 |
|
33 | 32 |
~VirtualNetworkTemplate(){}; |
34 | 33 |
|
35 |
/** |
|
36 |
* Checks the template for RESTRICTED ATTRIBUTES |
|
37 |
* @param rs_attr the first restricted attribute found if any |
|
38 |
* @return true if a restricted attribute is found in the template |
|
39 |
*/ |
|
40 |
bool check(string& rs_attr) |
|
34 |
// ------------------------------------------------------------------------- |
|
35 |
// Restricted attributes interface implementation |
|
36 |
// ------------------------------------------------------------------------- |
|
37 |
virtual void remove_restricted() |
|
41 | 38 |
{ |
42 |
return Template::check(rs_attr, restricted_attributes);
|
|
39 |
Template::remove_restricted(restricted);
|
|
43 | 40 |
}; |
44 | 41 |
|
45 |
/** |
|
46 |
* Deletes all restricted attributes |
|
47 |
*/ |
|
48 |
void remove_restricted() |
|
42 |
virtual bool check_restricted(string& rs_attr, const Template& base) |
|
49 | 43 |
{ |
50 |
Template::remove_restricted(restricted_attributes);
|
|
51 |
};
|
|
44 |
return Template::check_restricted(rs_attr, base, restricted);
|
|
45 |
} |
|
52 | 46 |
|
53 |
/** |
|
54 |
* Deletes all the attributes, except the restricted ones |
|
55 |
*/ |
|
56 |
void remove_all_except_restricted() |
|
47 |
virtual bool check_restricted(string& rs_attr) |
|
57 | 48 |
{ |
58 |
Template::remove_all_except_restricted(restricted_attributes);
|
|
59 |
};
|
|
49 |
return Template::check_restricted(rs_attr, restricted);
|
|
50 |
} |
|
60 | 51 |
|
61 |
private: |
|
62 |
|
|
63 |
friend class VirtualNetworkPool; |
|
64 |
|
|
65 |
static vector<string> restricted_attributes; |
|
66 |
|
|
67 |
bool has_restricted() |
|
52 |
static void parse_restricted(vector<const SingleAttribute *>& ra) |
|
68 | 53 |
{ |
69 |
return restricted_attributes.size() > 0;
|
|
70 |
};
|
|
54 |
Template::parse_restricted(ra, restricted);
|
|
55 |
} |
|
71 | 56 |
|
57 |
private: |
|
72 | 58 |
/** |
73 |
* Stores the attributes as restricted, these attributes will be used in |
|
74 |
* VirtualMachineTemplate::check |
|
75 |
* @param rattrs Attributes to restrict |
|
59 |
* Restricted attribute list for VirtualNetworkTemplates |
|
76 | 60 |
*/ |
77 |
static void set_restricted_attributes(vector<const SingleAttribute *>& rattrs) |
|
78 |
{ |
|
79 |
Template::set_restricted_attributes(rattrs, restricted_attributes); |
|
80 |
}; |
|
61 |
static std::map<std::string, std::set<std::string> > restricted; |
|
81 | 62 |
}; |
82 | 63 |
|
83 | 64 |
/* -------------------------------------------------------------------------- */ |
Also available in: Unified diff