cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsMacros.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
20 #pragma once
21 #ifndef _mtsMacros_h
22 #define _mtsMacros_h
23 
25 // the following macro is now part of cisstCommon, cmnAccessorMacros.h
26 #define MTS_DECLARE_MEMBER_AND_ACCESSORS CMN_DECLARE_MEMBER_AND_ACCESSORS
27 
28 // deprecated macro
29 #define MTS_PROXY_CLASS_DECLARATION_FROM(className, newName) You_should_use__MTS_MULTIPLE_INHERITANCE_FROM_MTS_GENERIC__instead
30 
34 #define MTS_MULTIPLE_INHERITANCE_FROM_MTS_GENERIC(className, newName) \
35 class newName: public mtsGenericObject, public className \
36 { \
37  CMN_DECLARE_SERVICES_EXPORT(CMN_DYNAMIC_CREATION, CMN_LOG_DEFAULT_LOD); \
38 public: \
39  newName(void): mtsGenericObject(), className() {} \
40  newName(const className & other): \
41  mtsGenericObject(), \
42  className(other) {} \
43  void ToStream(std::ostream & outputStream) const { \
44  mtsGenericObject::ToStream(outputStream); \
45  outputStream << std::endl; \
46  className::ToStream(outputStream); \
47  } \
48  void SerializeRaw(std::ostream & outputStream) const { \
49  mtsGenericObject::SerializeRaw(outputStream); \
50  className::SerializeRaw(outputStream); \
51  } \
52  void DeSerializeRaw(std::istream & inputStream) { \
53  mtsGenericObject::DeSerializeRaw(inputStream); \
54  className::DeSerializeRaw(inputStream); \
55  } \
56  void ToStreamRaw(std::ostream & outputStream, \
57  const char delimiter = ' ', \
58  bool headerOnly = false, \
59  const std::string & headerPrefix = "") const { \
60  mtsGenericObject::ToStreamRaw(outputStream, delimiter, \
61  headerOnly, headerPrefix); \
62  outputStream << delimiter; \
63  className::ToStreamRaw(outputStream, delimiter, \
64  headerOnly, headerPrefix); \
65  } \
66  className & Data(void) { \
67  return *this; \
68  } \
69  const className & Data(void) const { \
70  return *this; \
71  } \
72 }; \
73 inline std::ostream & operator << (std::ostream & output, \
74  const newName & object) { \
75  object.ToStream(output); \
76  return output; \
77 } \
78 CMN_DECLARE_SERVICES_INSTANTIATION(newName)
79 
80 
81 #endif // _mtsMacros_h
82 
Accessor macros.