xc
NamedEntity.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //NamedEntity.h
22 //Named entity.
23 
24 #ifndef ENTCONNMB_H
25 #define ENTCONNMB_H
26 
27 #include <string>
28 #include "CommandEntity.h"
29 
31 //
33 //
35 //
38  {
39  private:
40  std::string name;
41  public:
43  NamedEntity(const std::string &Name="",CommandEntity *owr= nullptr)
44  : CommandEntity(owr), name(Name) {}
46  const std::string &getName(void) const
47  { return name; }
49  void setName(const std::string &s)
50  { name= s; }
52  std::string &Name(void)
53  { return name; }
55  inline virtual bool operator==(const NamedEntity &other) const
56  { return (name==other.name); }
58  inline bool operator<(const NamedEntity &other) const
59  { return (name<other.name); }
63 
64  boost::python::dict getPyDict(void) const;
65  void setPyDict(const boost::python::dict &);
66  };
67 
68 NamedEntity operator+(const NamedEntity &,const NamedEntity &);
69 NamedEntity operator-(const NamedEntity &,const NamedEntity &);
70 NamedEntity operator*(const NamedEntity &,const NamedEntity &);
71 
72 #endif
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: NamedEntity.cc:34
NamedEntity & operator+=(const NamedEntity &)
+= operator.
Definition: NamedEntity.cc:41
NamedEntity & operator*=(const NamedEntity &)
*= operator.
Definition: NamedEntity.cc:55
bool operator<(const NamedEntity &other) const
Less than operator.
Definition: NamedEntity.h:58
std::string & Name(void)
Return a reference to the object name.
Definition: NamedEntity.h:52
Objet that can execute python scripts.
Definition: CommandEntity.h:40
const std::string & getName(void) const
Return the object name.
Definition: NamedEntity.h:46
void setName(const std::string &s)
Set the object name.
Definition: NamedEntity.h:49
Object identified by a name.
Definition: NamedEntity.h:37
virtual bool operator==(const NamedEntity &other) const
Comparison operator.
Definition: NamedEntity.h:55
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: NamedEntity.cc:26
NamedEntity & operator-=(const NamedEntity &)
-= operator.
Definition: NamedEntity.cc:48
NamedEntity(const std::string &Name="", CommandEntity *owr=nullptr)
Constructor.
Definition: NamedEntity.h:43