Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Capabilities.h
bloba5364e4ac7ba597e4642349307e471baba95beed
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Capabilities.h
7 * @author Arturo Montes <mitosys@colomsat.net.co>
8 */
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)
19 # 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
30 /**
31 * @class ACE_CapEntry
33 * @brief This class is the base class for all ACE Capabilities entry
34 * subclasses.
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
42 public:
43 virtual ~ACE_CapEntry () = default;
45 protected:
46 enum
48 ACE_INTCAP = 0,
49 ACE_STRINGCAP = 1,
50 ACE_BOOLCAP = 2
53 ACE_CapEntry (int captype);
55 protected:
56 int captype_;
59 /**
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
65 * values.
67 class ACE_Export ACE_IntCapEntry : public ACE_CapEntry
69 public:
70 ACE_IntCapEntry (int val);
71 int getval () const;
72 ACE_ALLOC_HOOK_DECLARE;
74 protected:
75 int val_;
78 /**
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
84 * values.
86 class ACE_Export ACE_StringCapEntry : public ACE_CapEntry
88 public:
89 ACE_StringCapEntry (const ACE_TString &val);
90 ACE_TString getval () const;
91 ACE_ALLOC_HOOK_DECLARE;
93 protected:
94 ACE_TString val_;
97 /**
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
103 * values.
105 class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry
107 public:
108 ACE_BoolCapEntry (int val);
109 int getval () const;
110 ACE_ALLOC_HOOK_DECLARE;
112 protected:
113 int val_;
117 * @class ACE_Capabilities
119 * @brief
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
134 public:
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;
137 /// The Constructor
138 ACE_Capabilities ();
140 /// The Destructor
141 ~ACE_Capabilities();
143 public:
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);
154 protected:
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,
169 ACE_TString &line);
171 /// Is a valid entry
172 int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line);
174 /// Reset the set of capabilities
175 void resetcaps ();
177 private:
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__ */