DataFieldIdentifier.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX::Core
19 * @author Kai Welke (welke _at_ kit _dot_ edu)
20 * @date 2011 Kai Welke
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
28 #include <ArmarXCore/interface/observers/DataFieldIdentifierBase.h>
29 
30 #include <string>
31 #include <ostream>
32 
33 namespace armarx
34 {
35  class DataFieldIdentifier;
36  /**
37  * Typedef of DataFieldIdentifierPtr as IceInternal::Handle<DataFieldIdentifier> for convenience.
38  */
40 
41  /**
42  * DataFieldIdentifier provide the basis to identify data field within a distributed
43  * ArmarX scenario.
44  * Data fields are provided by observers which again are fed by SensorActor units.
45  * An Observer allows defining several condition checks on data fields
46  * that generate the events necessary for the robot program (Operation) logic.
47  */
49  virtual public DataFieldIdentifierBase
50  {
51  public:
52  /**
53  * Creates an empty DataFieldIdentifier. Required for Ice ObjectFactory
54  */
56 
57  /**
58  * Creates a DataFieldIdentifier from string.
59  *
60  * @param dataFieldIdentifierStr string in the format "observername.channelname.datafieldname"
61  */
62  DataFieldIdentifier(std::string dataFieldIdentifierStr);
63 
64  /**
65  * Creates a DataFieldIdentifier from string.
66  *
67  * @param observerName name of the observer
68  * @param channelName name of the channel
69  * @param datafieldName name of the datafield
70  */
71  DataFieldIdentifier(std::string observerName, std::string channelName, std::string datafieldName);
72 
73  /**
74  * Retrieve data field identifier string
75  *
76  * @return string which identifies the datafield
77  */
78  std::string getIdentifierStr() const;
79 
80  /**
81  * Test two DataFieldIdentifier for equality
82  *
83  * @param dataFieldIdentifier identifier to test for equality
84  * @return equality
85  */
86  bool equals(const DataFieldIdentifier& dataFieldIdentifier);
87 
88  /**
89  * Test if one DataFieldIdentifier contains the other
90  *
91  * @param dataFieldIdentifier identifier to check for standing at the beginning
92  * @return beginsWith
93  */
94  bool beginsWith(const DataFieldIdentifier& dataFieldIdentifier);
95 
96  /**
97  * Retrieve observer name
98  *
99  * @return name of the observer
100  */
101  std::string getObserverName() const
102  {
103  return observerName;
104  }
105 
106  /**
107  * Retrieve channel name
108  *
109  * @return name of the channel
110  */
111  std::string getChannelName() const
112  {
113  return channelName;
114  }
115 
116  /**
117  * Retrieve datafield name
118  *
119  * @return name of the datafield
120  */
121  std::string getDataFieldName() const
122  {
123  return datafieldName;
124  }
125 
126  /**
127  * stream operator for DataFieldIdentifier
128  */
129  friend std::ostream& operator<<(std::ostream& stream, const DataFieldIdentifier& rhs)
130  {
131  stream << rhs.getIdentifierStr();
132  return stream;
133  }
134 
135  /**
136  * stream operator for Ice shared pointer of DataFieldIdentifier
137  */
138  friend std::ostream& operator<<(std::ostream& stream, const DataFieldIdentifierPtr& rhs)
139  {
140  stream << rhs->getIdentifierStr();
141  return stream;
142  }
143  };
144 }
145 extern template class ::IceInternal::Handle< ::armarx::DataFieldIdentifier>;
146 
armarx::DataFieldIdentifier::getObserverName
std::string getObserverName() const
Retrieve observer name.
Definition: DataFieldIdentifier.h:101
IceInternal::Handle< DataFieldIdentifier >
armarx::DataFieldIdentifier::getChannelName
std::string getChannelName() const
Retrieve channel name.
Definition: DataFieldIdentifier.h:111
armarx::DataFieldIdentifier::getDataFieldName
std::string getDataFieldName() const
Retrieve datafield name.
Definition: DataFieldIdentifier.h:121
armarx::DataFieldIdentifier::getIdentifierStr
std::string getIdentifierStr() const
Retrieve data field identifier string.
Definition: DataFieldIdentifier.cpp:56
armarx::DataFieldIdentifier::DataFieldIdentifier
DataFieldIdentifier()
Creates an empty DataFieldIdentifier.
Definition: DataFieldIdentifier.h:55
armarx::DataFieldIdentifier::operator<<
friend std::ostream & operator<<(std::ostream &stream, const DataFieldIdentifier &rhs)
stream operator for DataFieldIdentifier
Definition: DataFieldIdentifier.h:129
ImportExport.h
armarx::DataFieldIdentifier::operator<<
friend std::ostream & operator<<(std::ostream &stream, const DataFieldIdentifierPtr &rhs)
stream operator for Ice shared pointer of DataFieldIdentifier
Definition: DataFieldIdentifier.h:138
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::DataFieldIdentifier
DataFieldIdentifier provide the basis to identify data field within a distributed ArmarX scenario.
Definition: DataFieldIdentifier.h:48