xc
EntityWithOwner.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 //EntityWithOwner.h
22 //Entidad con punetero a su propietaria.
23 
24 #ifndef ENTITYWITHOWNER_H
25 #define ENTITYWITHOWNER_H
26 
27 #include <string>
28 #include <boost/python.hpp>
29 #include <boost/python/dict.hpp>
30 
32 //
35  {
36  private:
37  EntityWithOwner *owner;
38  protected:
39  static int verbosity;
40  virtual bool isEqual(const EntityWithOwner &) const;
41  public:
42  EntityWithOwner(EntityWithOwner *owr= nullptr);
45  virtual bool operator==(const EntityWithOwner &) const;
47  virtual ~EntityWithOwner(void) {}
48 
49  static int getVerbosityLevel(void);
50  static void setVerbosityLevel(const int &);
51  virtual std::string getClassName(void) const;
52 
53  virtual boost::python::dict getPyDict(void) const;
54  virtual void setPyDict(const boost::python::dict &);
55 
56  void set_owner(EntityWithOwner *owr);
57  inline EntityWithOwner *Owner(void)
58  { return owner; }
59  inline const EntityWithOwner *Owner(void) const
60  { return owner; }
61  };
62 
63 #endif
static void setVerbosityLevel(const int &)
Set the value of the verbosity level.
Definition: EntityWithOwner.cc:107
EntityWithOwner & operator=(const EntityWithOwner &)
Assignment operator.
Definition: EntityWithOwner.cc:53
Entity with a pointer to its owner.
Definition: EntityWithOwner.h:34
static int verbosity
Object that owns THIS ONE.
Definition: EntityWithOwner.h:39
virtual ~EntityWithOwner(void)
Virtual destructor.
Definition: EntityWithOwner.h:47
static int getVerbosityLevel(void)
Get the value of the verbosity level.
Definition: EntityWithOwner.cc:103
virtual bool isEqual(const EntityWithOwner &) const
Return true if both objects are equal.
Definition: EntityWithOwner.cc:69
virtual std::string getClassName(void) const
Returns demangled class name.
Definition: EntityWithOwner.cc:90
virtual bool operator==(const EntityWithOwner &) const
Comparison operator.
Definition: EntityWithOwner.cc:86
virtual boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: EntityWithOwner.cc:115
virtual void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: EntityWithOwner.cc:124
void set_owner(EntityWithOwner *owr)
Assigns the owner of the object.
Definition: EntityWithOwner.cc:111
EntityWithOwner(EntityWithOwner *owr=nullptr)
Default constructor.
Definition: EntityWithOwner.cc:33