casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tag.h
Go to the documentation of this file.
1 /*
2  * ALMA - Atacama Large Millimeter Array
3  * (c) European Southern Observatory, 2002
4  * (c) Associated Universities Inc., 2002
5  * Copyright by ESO (in the framework of the ALMA collaboration),
6  * Copyright by AUI (in the framework of the ALMA collaboration),
7  * All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY, without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22  * MA 02111-1307 USA
23  *
24  * File Tag.h
25  */
26 
27 #ifndef Tag_CLASS
28 #define Tag_CLASS
29 
30 #include <vector>
31 #include <iostream>
32 #include <string>
33 #include <sstream>
34 #include <vector>
35 
36 #ifndef WITHOUT_ACS
37 #include <asdmIDLTypesC.h>
38 #endif
39 
40 #ifndef WITHOUT_BOOST
41 #include <boost/regex.hpp>
42 #else
43 #include <regex>
44 #endif
45 
49 #include <alma/ASDM/TagType.h>
51 
52 #include <alma/ASDM/EndianStream.h>
53 
54 namespace asdm {
55 
56 class Tag;
73 class Tag {
74 
75 public:
79  Tag();
80 
87  Tag(unsigned int i);
88 
96  Tag(unsigned int i, const TagType* t) ;
97 
101  Tag(const Tag &t);
102 
103 
104  //Tag(const string &id);
105 #ifndef WITHOUT_ACS
106 
112  Tag(asdmIDLTypes::IDLTag &t);
113 #endif
114 
120  friend std::ostream & operator << (std::ostream& os, const Tag & x);
121 
125  friend std::istream & operator >> (std::istream & is, Tag & x);
126 
132  static Tag parseTag (std::string s);
133 
140  std::string toString() const;
141 
145  void toBin(EndianOSStream& eoss);
146 
152  static void toBin(const std::vector<Tag>& tag, EndianOSStream& eoss) ;
153 
161  static Tag fromBin(EndianIStream& eis);
162 
170  static std::vector<Tag> from1DBin(EndianIStream & eis);
171 
175  virtual ~Tag();
176 
184  TagType* getTagType();
185 
193  unsigned int getTagValue() const;
194 
195 #ifndef WITHOUT_ACS
196 
201  asdmIDLTypes::IDLTag toIDLTag() const;
202 #endif
203 
209  std::string getTag() const;
210 
214  Tag& operator = (const Tag &);
215 
219  bool equals(const Tag & t) const;
220 
227  bool operator == (const Tag& t) const;
228 
232  bool operator != (const Tag& t) const;
233 
239  bool operator < (const Tag& t) const;
240 
246  bool operator > (const Tag& t) const;
247 
248 
253  bool isNull() const;
254 
255 protected:
256  std::string tag;
258 
259  private:
260 #ifndef WITHOUT_BOOST
262 #else
263  static std::regex tagSyntax;
264 #endif
265 };
266 
267 // End namespace asdm
268 }
269 #endif /* Tag_CLASS */
friend std::ostream & operator<<(std::ostream &os, const Tag &x)
Overloading of &lt;&lt; to output the value of a Tag on an ostream.
bool isNull() const
Return true if and only if this Tag is null, i.e.
virtual ~Tag()
The Tag destructor.
bool equals(const Tag &t) const
static std::vector< Tag > from1DBin(EndianIStream &eis)
Read the binary representation of a of a vector of Tag from an EndianIStream and use the read value t...
void toBin(EndianOSStream &eoss)
Write the binary representation of this to a EndianOSStream.
static Tag fromBin(EndianIStream &eis)
Read the binary representation of a Tag from a EndianIStream.
asdmIDLTypes::IDLTag toIDLTag() const
Returns a IDLTag object built from this Tag.
Tag & operator=(const Tag &)
Assignment operator.
bool operator==(const Tag &t) const
TagType * type
Definition: Tag.h:257
TagType * getTagType()
Returns the type of this Tag.
bool operator<(const Tag &t) const
std::string toString() const
Return the Tag as a String.
std::string tag
Definition: Tag.h:256
bool operator>(const Tag &t) const
static Tag parseTag(std::string s)
Create a Tag whose initial value is the specified string.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
unsigned int getTagValue() const
Returns the value of this Tag.
bool operator!=(const Tag &t) const
A class to represent the type of Tag , i.e.
Definition: TagType.h:12
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition: ExprNode.h:1440
static boost::regex tagSyntax
Definition: Tag.h:261
friend std::istream & operator>>(std::istream &is, Tag &x)
Overloading of &gt;&gt; to read a Tag from an istream.
Tag()
Create a default Tag that is null.
std::string Tag
Definition: ds9context.h:25
std::string getTag() const
Return this Tag value as a string.