MessageMember.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2014 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
23 #ifndef VARIANT_TOPIC_TOOLS_MESSAGE_MEMBER_H
24 #define VARIANT_TOPIC_TOOLS_MESSAGE_MEMBER_H
25 
27 
28 namespace variant_topic_tools {
31  class MessageMember {
32  friend class MessageDataType;
33  public:
36  MessageMember();
37 
40  MessageMember(const MessageMember& src);
41 
45 
48  const std::string& getName() const;
49 
52  const DataType& getType() const;
53 
56  bool isVariable() const;
57 
60  bool isConstant() const;
61 
64  bool isValid() const;
65 
68  void write(std::ostream& stream) const;
69 
72  inline operator void*() const {
73  return (impl) ? (void*)1 : (void*)0;
74  };
75 
76  protected:
79  class Impl {
80  public:
83  Impl(const std::string& name);
84 
87  virtual ~Impl();
88 
92  virtual const DataType& getType() const = 0;
93 
96  virtual void write(std::ostream& stream) const = 0;
97 
100  std::string name;
101  };
102 
106 
110  typedef boost::weak_ptr<Impl> ImplWPtr;
111 
114  ImplPtr impl;
115  };
116 
119  std::ostream& operator<<(std::ostream& stream, const MessageMember&
120  messageMember);
121 };
122 
123 #endif
Impl(const std::string &name)
Constructor.
std::string name
The name of this message member.
Header file providing forward declarations for the variant topic tools.
ImplPtr impl
The message member&#39;s implementation.
boost::weak_ptr< Impl > ImplWPtr
Declaration of the message member implementation weak pointer type.
MessageMember()
Default constructor.
const std::string & getName() const
Retrieve the name of this message member.
boost::shared_ptr< Impl > ImplPtr
Declaration of the message member implementation pointer type.
std::ostream & operator<<(std::ostream &stream, const DataType &dataType)
Operator for writing the data type to a stream.
Definition: DataType.cpp:190
bool isVariable() const
True, if this message member is a variable member.
virtual const DataType & getType() const =0
Retrieve the type of this message member (abstract declaration)
bool isValid() const
True, if this message member is valid.
const DataType & getType() const
Retrieve the type of this message member.
void write(std::ostream &stream) const
Write the message member to a stream.
Message member implementation.
Definition: MessageMember.h:79
virtual void write(std::ostream &stream) const =0
Write the message member to a stream (abstract declaration)
bool isConstant() const
True, if this message member is a constant member.


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:49