GenApi  3.5.1
INode.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 by Basler Vision Technologies
3 // Author: Fritz Dierks
4 //
5 // License: This file is published under the license of the EMVA GenICam Standard Group.
6 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7 // If for some reason you are missing this file please contact the EMVA or visit the website
8 // (http://www.genicam.org) for a full copy.
9 //
10 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 // POSSIBILITY OF SUCH DAMAGE.
21 //
22 //-----------------------------------------------------------------------------
30 #ifndef GENAPI_INODE_H
31 #define GENAPI_INODE_H
32 
33 #include <Base/GCString.h>
34 #include <GenApi/GenApiDll.h>
35 #include <GenApi/Types.h>
36 #include <GenApi/IBase.h>
37 #include <GenApi/Container.h>
38 
39 #include <assert.h>
40 
41 #ifdef _MSC_VER
42 # pragma warning ( push )
43 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
44 #endif
45 
46 namespace GENAPI_NAMESPACE
47 {
48 
49  GENICAM_INTERFACE INode;
50  GENICAM_INTERFACE INodeMap;
51 
53  typedef node_vector NodeList_t;
54 
56  typedef intptr_t CallbackHandleType;
57 
58  class CNodeCallback;
59 
60  //*************************************************************
61  // INode interface
62  //*************************************************************
63 
68  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT INode : virtual public IBase
69  {
71  virtual GENICAM_NAMESPACE::gcstring GetName(bool FullQualified=false) const = 0;
72 
74  virtual GENAPI_NAMESPACE::ENameSpace GetNameSpace() const = 0;
75 
77  virtual EVisibility GetVisibility() const = 0;
78 
80 
81  virtual void InvalidateNode() = 0;
82 
84  virtual bool IsCachable() const = 0;
85 
87  virtual EYesNo IsAccessModeCacheable() const = 0;
88 
90  virtual ECachingMode GetCachingMode() const = 0;
91 
93  virtual int64_t GetPollingTime() const = 0;
94 
96  virtual GENICAM_NAMESPACE::gcstring GetToolTip() const = 0;
97 
99  virtual GENICAM_NAMESPACE::gcstring GetDescription() const = 0;
100 
102  virtual GENICAM_NAMESPACE::gcstring GetDisplayName() const = 0;
103 
105  virtual GENICAM_NAMESPACE::gcstring GetDeviceName() const = 0;
106 
112  virtual void GetChildren(GENAPI_NAMESPACE::NodeList_t &Children, ELinkType LinkType=ctReadingChildren) const = 0;
113 
118  virtual void GetParents(GENAPI_NAMESPACE::NodeList_t &Parents) const = 0;
119 
121 
122  virtual CallbackHandleType RegisterCallback( CNodeCallback *pCallback ) = 0;
123 
125 
128  virtual bool DeregisterCallback( CallbackHandleType hCallback ) = 0;
129 
131  virtual INodeMap* GetNodeMap() const = 0;
132 
134  virtual GENICAM_NAMESPACE::gcstring GetEventID() const = 0;
135 
137  virtual bool IsStreamable() const = 0;
138 
140  virtual void GetPropertyNames(GENICAM_NAMESPACE::gcstring_vector &PropertyNames) const = 0;
141 
143 
144  virtual bool GetProperty(const GENICAM_NAMESPACE::gcstring& PropertyName, GENICAM_NAMESPACE::gcstring& ValueStr, GENICAM_NAMESPACE::gcstring& AttributeStr) = 0;
145 
147  virtual void ImposeAccessMode(EAccessMode ImposedAccessMode) = 0;
148 
150  virtual void ImposeVisibility(EVisibility ImposedVisibility) = 0;
151 
153  virtual INode* GetAlias() const = 0;
154 
156  virtual INode* GetCastAlias() const = 0;
157 
159  virtual GENICAM_NAMESPACE::gcstring GetDocuURL() const = 0;
160 
162  virtual bool IsDeprecated() const = 0;
163 
165  virtual EInterfaceType GetPrincipalInterfaceType() const = 0;
166 
168  virtual bool IsFeature() const = 0;
169 
170  };
171 
174 
176  inline bool IsReadable( EAccessMode AccessMode )
177  {
178  return RO == AccessMode || RW == AccessMode;
179  }
180 
182  inline bool IsReadable( const IBase* p)
183  {
184  return (p != NULL) && IsReadable( p->GetAccessMode() );
185  }
186 
188  inline bool IsReadable( const IBase& r)
189  {
190  return IsReadable( r.GetAccessMode() );
191  }
192 
194  inline bool IsWritable( EAccessMode AccessMode )
195  {
196  return WO == AccessMode || RW == AccessMode;
197  }
198 
200  inline bool IsWritable( const IBase* p)
201  {
202  return (p != NULL) && IsWritable( p->GetAccessMode() );
203  }
204 
206  inline bool IsWritable( const IBase& r)
207  {
208  return IsWritable( r.GetAccessMode() );
209  }
210 
212  inline bool IsImplemented( EAccessMode AccessMode )
213  {
214  return AccessMode != NI;
215  }
216 
218  inline bool IsImplemented( const IBase* p)
219  {
220  return (p != NULL) && IsImplemented(p->GetAccessMode() );
221  }
222 
224  inline bool IsImplemented( const IBase& r)
225  {
226  return IsImplemented(&r);
227  }
228 
230  inline bool IsAvailable( EAccessMode AccessMode )
231  {
232  return ! ( AccessMode == NA || AccessMode == NI );
233  }
234 
236  inline bool IsAvailable( const IBase* p)
237  {
238  return (p != NULL) && IsAvailable(p->GetAccessMode() );
239  }
240 
242  inline bool IsAvailable( const IBase& r)
243  {
244  return IsAvailable(r.GetAccessMode() );
245  }
246 
249  {
250  assert( Peter != _UndefinedAccessMode );
251  assert( Paul != _UndefinedAccessMode );
252 
253  if( Peter == NI || Paul == NI )
254  return NI;
255  else if( Peter == NA || Paul == NA )
256  return NA;
257  else if( (Peter == RO && Paul == WO) || (Peter == WO && Paul == RO) )
258  return NA;
259  else if( Peter == WO || Paul == WO )
260  return WO;
261  else if( Peter == RO || Paul == RO )
262  return RO;
263  else
264  return RW;
265  }
266 
267 
269 
270  inline bool IsVisible( EVisibility Visibility, EVisibility MaxVisiblity )
271  {
272  return (Visibility <= MaxVisiblity);
273  }
274 
275 
278  {
279  assert( Peter != _UndefinedVisibility );
280  assert( Paul != _UndefinedVisibility );
281 
282  if( Peter == Invisible || Paul == Invisible )
283  return Invisible;
284  else if( Peter == Guru || Paul == Guru )
285  return Guru;
286  else if( Peter == Expert || Paul == Expert )
287  return Expert;
288  else
289  return Beginner;
290  }
291 
292 
294  inline bool IsCacheable( ECachingMode CachingMode )
295  {
296  return (CachingMode != NoCache);
297  }
298 
301  {
302  assert( Peter != _UndefinedCachingMode );
303  assert( Paul != _UndefinedCachingMode );
304 
305  if( Peter == NoCache || Paul == NoCache )
306  return NoCache;
307  else if( Peter == WriteAround || Paul == WriteAround )
308  return WriteAround;
309  else
310  return WriteThrough;
311  }
312 
314 
315 }
316 
317 #ifdef _MSC_VER
318 # pragma warning ( pop )
319 #endif
320 
321 #endif // ifndef GENAPI_INODE_H
Definition of interface IBase.
virtual bool DeregisterCallback(CallbackHandleType hCallback)=0
De register change callback.
Object is not yet initialized.
Definition: Types.h:71
Common types used in the public GenApi interface.
bool IsImplemented(const IBase &r)
Checks if a node is implemented.
Definition: INode.h:224
virtual bool IsDeprecated() const =0
True if the node should not be used any more.
virtual INode * GetCastAlias() const =0
Retrieves the a node which describes the same feature so that it can be casted.
virtual GENICAM_NAMESPACE::gcstring GetDescription() const =0
Get a long description of the node.
bool IsAvailable(const IBase &r)
Checks if a node is available.
Definition: INode.h:242
enum GENAPI_NAMESPACE::_ENameSpace ENameSpace
virtual INodeMap * GetNodeMap() const =0
Retrieves the central node map.
Write Only.
Definition: Types.h:56
GENICAM_INTERFACE INode
Interface common to all nodes.
Definition: ICategory.h:49
enum GENAPI_NAMESPACE::_EYesNo EYesNo
bool IsCacheable(ECachingMode CachingMode)
Tests Cacheability.
Definition: INode.h:294
Visible for Gurus.
Definition: Types.h:69
ECachingMode Combine(ECachingMode Peter, ECachingMode Paul)
Computes which CachingMode results from a combination.
Definition: INode.h:300
virtual CallbackHandleType RegisterCallback(CNodeCallback *pCallback)=0
Register change callback.
enum GENAPI_NAMESPACE::_ELinkType ELinkType
typedef for link type
enum GENAPI_NAMESPACE::_ECachingMode ECachingMode
Do not use cache.
Definition: Types.h:78
enum GENAPI_NAMESPACE::_EVisibility EVisibility
callback body instance for INode pointers
Definition: NodeCallback.h:53
virtual ECachingMode GetCachingMode() const =0
Get Caching Mode.
virtual GENAPI_NAMESPACE::ENameSpace GetNameSpace() const =0
Get name space.
virtual void ImposeVisibility(EVisibility ImposedVisibility)=0
Imposes a visibility to the natural visibility of the node.
node_vector NodeList_t
a list of node references
Definition: INode.h:53
virtual GENICAM_NAMESPACE::gcstring GetEventID() const =0
Get the EventId of the node.
Not Visible.
Definition: Types.h:70
bool IsWritable(const IBase &r)
Checks if a node is writable.
Definition: INode.h:206
virtual EYesNo IsAccessModeCacheable() const =0
True if the AccessMode can be cached.
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
virtual INode * GetAlias() const =0
Retrieves the a node which describes the same feature in a different way.
virtual EVisibility GetVisibility() const =0
Get the recommended visibility of the node.
Write to cache and register.
Definition: Types.h:79
Write to register, write to cache on read.
Definition: Types.h:80
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBase
Base interface common to all nodes.
Definition: IBase.h:53
bool IsVisible(EVisibility Visibility, EVisibility MaxVisiblity)
Tests Visibility.
Definition: INode.h:270
virtual bool IsFeature() const =0
True if the node can be reached via category nodes from a category node named "Root".
Read and Write.
Definition: Types.h:58
Visible for experts or Gurus.
Definition: Types.h:68
Read Only.
Definition: Types.h:57
virtual EInterfaceType GetPrincipalInterfaceType() const =0
Get the type of the main interface of a node.
Not available.
Definition: Types.h:55
Object is not yet initialized.
Definition: Types.h:59
virtual void GetParents(GENAPI_NAMESPACE::NodeList_t &Parents) const =0
Gets all nodes this node is directly depending on.
virtual void InvalidateNode()=0
Indicates that the node&#39;s value may have changed.
Not yet initialized.
Definition: Types.h:81
bool IsReadable(const IBase &r)
Checks if a node is readable.
Definition: INode.h:188
Always visible.
Definition: Types.h:67
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
virtual GENICAM_NAMESPACE::gcstring GetDisplayName() const =0
Get a name string for display.
intptr_t CallbackHandleType
the callback handle for nodes
Definition: INode.h:56
GENICAM_INTERFACE INodeMap
Interface to access the node map.
Definition: INode.h:50
virtual void ImposeAccessMode(EAccessMode ImposedAccessMode)=0
Imposes an access mode to the natural access mode of the node.
A string class which is a clone of std::string.
Definition: GCString.h:50
virtual bool IsCachable() const =0
Is the node value cachable.
virtual bool GetProperty(const GENICAM_NAMESPACE::gcstring &PropertyName, GENICAM_NAMESPACE::gcstring &ValueStr, GENICAM_NAMESPACE::gcstring &AttributeStr)=0
Retrieves a property plus an additional attribute by name.
virtual GENICAM_NAMESPACE::gcstring GetToolTip()=0
Get tool tip.
virtual void GetPropertyNames(GENICAM_NAMESPACE::gcstring_vector &PropertyNames) const =0
Returns a list of the names all properties set during initialization.
Portable string implementation.
virtual void GetChildren(GENAPI_NAMESPACE::NodeList_t &Children, ELinkType LinkType=ctReadingChildren) const =0
Get all nodes this node directly depends on.
All nodes which can be read from.
Definition: Types.h:209
declspec&#39;s to be used for GenApi Windows dll
virtual GENICAM_NAMESPACE::gcstring GetDeviceName() const =0
Get a name of the device.
Portable container classes for INode & IValue pointers.
Not implemented.
Definition: Types.h:54
virtual bool IsStreamable() const =0
True if the node is streamable.
Definition: ChunkAdapter.h:37
virtual GENICAM_NAMESPACE::gcstring GetDocuURL() const =0
Gets a URL pointing to the documentation of that feature.
virtual int64_t GetPollingTime() const =0
recommended polling time (for not cachable nodes)