cisst-saw
Loading...
Searching...
No Matches
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
18
19#pragma once
20#ifndef _mtsMacros_h
21#define _mtsMacros_h
22
24// the following macro is now part of cisstCommon, cmnAccessorMacros.h
25#define MTS_DECLARE_MEMBER_AND_ACCESSORS CMN_DECLARE_MEMBER_AND_ACCESSORS
26
27// deprecated macro
28#define MTS_PROXY_CLASS_DECLARATION_FROM(className, newName) You_should_use__MTS_MULTIPLE_INHERITANCE_FROM_MTS_GENERIC__instead
29
33#define MTS_MULTIPLE_INHERITANCE_FROM_MTS_GENERIC(className, newName) \
34class newName: public mtsGenericObject, public className \
35{ \
36 CMN_DECLARE_SERVICES_EXPORT(CMN_DYNAMIC_CREATION, CMN_LOG_DEFAULT_LOD); \
37public: \
38 newName(void): mtsGenericObject(), className() {} \
39 newName(const className & other): \
40 mtsGenericObject(), \
41 className(other) {} \
42 void ToStream(std::ostream & outputStream) const override { \
43 mtsGenericObject::ToStream(outputStream); \
44 outputStream << std::endl; \
45 className::ToStream(outputStream); \
46 } \
47 void SerializeRaw(std::ostream & outputStream) const override { \
48 mtsGenericObject::SerializeRaw(outputStream); \
49 className::SerializeRaw(outputStream); \
50 } \
51 void DeSerializeRaw(std::istream & inputStream) override { \
52 mtsGenericObject::DeSerializeRaw(inputStream); \
53 className::DeSerializeRaw(inputStream); \
54 } \
55 void ToStreamRaw(std::ostream & outputStream, \
56 const char delimiter = ' ', \
57 bool headerOnly = false, \
58 const std::string & headerPrefix = "") const override { \
59 mtsGenericObject::ToStreamRaw(outputStream, delimiter, \
60 headerOnly, headerPrefix); \
61 outputStream << delimiter; \
62 className::ToStreamRaw(outputStream, delimiter, \
63 headerOnly, headerPrefix); \
64 } \
65 className & Data(void) { \
66 return *this; \
67 } \
68 const className & Data(void) const { \
69 return *this; \
70 } \
71}; \
72inline std::ostream & operator << (std::ostream & output, \
73 const newName & object) { \
74 object.ToStream(output); \
75 return output; \
76} \
77CMN_DECLARE_SERVICES_INSTANTIATION(newName)
78
79#endif // _mtsMacros_h
80
Accessor macros.