3 //=============================================================================
7 * @author Arturo Montes <mitosys@colomsat.net.co>
9 //=============================================================================
12 #ifndef ACE_CAPABILITIES_H
13 #define ACE_CAPABILITIES_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Null_Mutex.h"
23 #include "ace/Hash_Map_Manager_T.h"
24 #include "ace/Containers.h"
25 #include "ace/SString.h"
26 #include "ace/Functor_String.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
33 * @brief This class is the base class for all ACE Capabilities entry
36 * This class is not instantiable and does not provide accessors
37 * or methods. If you want to add a new kind of attribute subclass
38 * this class and dynamic_cast to proper subclass.
40 class ACE_Export ACE_CapEntry
43 virtual ~ACE_CapEntry () = default;
53 ACE_CapEntry (int captype
);
60 * @class ACE_IntCapEntry
62 * @brief This class implement the ACE Integer Capability subclass.
64 * This is a container class for ACE Capabilities integer container
67 class ACE_Export ACE_IntCapEntry
: public ACE_CapEntry
70 ACE_IntCapEntry (int val
);
72 ACE_ALLOC_HOOK_DECLARE
;
79 * @class ACE_StringCapEntry
81 * @brief This class implement the ACE String Capability subclass.
83 * This is a container class for ACE Capabilities String container
86 class ACE_Export ACE_StringCapEntry
: public ACE_CapEntry
89 ACE_StringCapEntry (const ACE_TString
&val
);
90 ACE_TString
getval () const;
91 ACE_ALLOC_HOOK_DECLARE
;
98 * @class ACE_BoolCapEntry
100 * @brief This class implement the ACE Bool Capability subclass.
102 * This is a container class for ACE Capabilities bool container
105 class ACE_Export ACE_BoolCapEntry
: public ACE_CapEntry
108 ACE_BoolCapEntry (int val
);
110 ACE_ALLOC_HOOK_DECLARE
;
117 * @class ACE_Capabilities
120 * This class implement the ACE Capabilities.
122 * This is a container class for ACE Capabilities
123 * values. Currently exist three different capability values:
124 * ACE_IntCapEntry (integer), ACE_BoolCapEntry (bool) and
125 * ACE_StringCapEntry (String). An ACE_Capabilities is a
126 * unordered set of pair = (String, ACE_CapEntry *). Where
127 * the first component is the name of capability and the second
128 * component is a pointer to the capability value container. A
129 * FILE is a container for ACE_Capabilities, the
130 * ACE_Capabilities has a name in the file, as a termcap file.
132 class ACE_Export ACE_Capabilities
135 typedef ACE_Hash_Map_Manager_Ex
<ACE_TString
, ACE_CapEntry
*, ACE_Hash
<ACE_TString
>, ACE_Equal_To
<ACE_TString
>, ACE_Null_Mutex
> CAPABILITIES_MAP
;
144 /// Get a string entry.
145 int getval (const ACE_TCHAR
*ent
, ACE_TString
&val
);
147 /// Get an integer entry.
148 int getval (const ACE_TCHAR
*ent
, int &val
);
150 /// Get the ACE_Capabilities name from FILE fname and load the
151 /// associated capabitily entries in map.
152 int getent (const ACE_TCHAR
*fname
, const ACE_TCHAR
*name
);
155 /// Parse an integer property
156 const ACE_TCHAR
*parse (const ACE_TCHAR
*buf
, int &cap
);
158 /// Parse a string property
159 const ACE_TCHAR
*parse (const ACE_TCHAR
*buf
, ACE_TString
&cap
);
161 /// Fill the ACE_Capabilities with description in ent.
162 int fillent(const ACE_TCHAR
*ent
);
164 /// Parse a cap entry
165 int parseent (const ACE_TCHAR
*name
, ACE_TCHAR
*line
);
167 /// Get a line from FILE input stream
168 int getline (FILE* fp
,
172 int is_entry (const ACE_TCHAR
*name
, const ACE_TCHAR
*line
);
174 /// Reset the set of capabilities
178 /// This is the set of ACE_CapEntry.
179 CAPABILITIES_MAP caps_
;
182 ACE_END_VERSIONED_NAMESPACE_DECL
184 #if defined (__ACE_INLINE__)
185 #include "ace/Capabilities.inl"
186 #endif /* __ACE_INLINE__ */
188 #include /**/ "ace/post.h"
189 #endif /* __ACE_CAPABILITIES_H__ */