xc
TaggedObject.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 /* ****************************************************************** **
29 ** OpenSees - Open System for Earthquake Engineering Simulation **
30 ** Pacific Earthquake Engineering Research Center **
31 ** **
32 ** **
33 ** (C) Copyright 1999, The Regents of the University of California **
34 ** All Rights Reserved. **
35 ** **
36 ** Commercial use of this program without express permission of the **
37 ** University of California, Berkeley, is strictly prohibited. See **
38 ** file 'COPYRIGHT' in main directory for information on usage and **
39 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
40 ** **
41 ** Developed by: **
42 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
43 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
44 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
45 ** **
46 ** ****************************************************************** */
47 
48 // $Revision: 1.2 $
49 // $Date: 2003/02/14 23:02:10 $
50 // $Source: /usr/local/cvs/OpenSees/SRC/utility/tagged/TaggedObject.h,v $
51 
52 
53 #ifndef TaggedObject_h
54 #define TaggedObject_h
55 
56 // File: ~/utility/tagged/TaggedObject.h
57 //
58 // Written: fmk
59 // Created: 11/96
60 // Revision: A
61 //
62 // Description: This file contains the class definition for TaggedObject.
63 // A TaggedObject is an object with an integer identifier. It is used as
64 // a base class by DomainComponent, Graph and other classes in the framework.
65 //
66 // What: "@(#) TaggedObject.h, revA"
67 
68 #include "utility/kernel/CommandEntity.h"
69 
70 namespace XC {
71 class Domain;
72 class Vector;
73 class Matrix;
74 class FEM_ObjectBroker;
75 
79 //
81 //
93  {
94  private:
95  int theTag;
96  protected:
97  friend class ElementHandler;
98  friend class Communicator;
99  template <class T> friend T *getBrokedTagged(const int &,const int &,const int &,FEM_ObjectBroker &,T *(FEM_ObjectBroker::*ptrFunc)(int));
100  void setTag(int newTag); // CAUTION: this is a dangerous method to call
101  bool isEqual(const TaggedObject &) const;
102  public:
103  TaggedObject(int tag,CommandEntity *owr= nullptr);
104  virtual TaggedObject *getCopy(void) const;
105  virtual ~TaggedObject(void) {}
106 
107  void assignTag(int newTag);
108  int getTag(void) const;
109 
110  virtual void Print(std::ostream &, int flag =0) const;
111  boost::python::dict getPyDict(void) const;
112  void setPyDict(const boost::python::dict &);
113  friend std::ostream &operator<<(std::ostream &, const TaggedObject &);
114  };
115 
116 std::ostream &operator<<(std::ostream &, const TaggedObject &);
117 
119 inline int TaggedObject::getTag(void) const
120  { return theTag; }
121 
122 } // end of XC namespace
123 
124 #endif
125 
126 
virtual void Print(std::ostream &, int flag=0) const
Print stuff.
Definition: TaggedObject.cpp:139
Communication parameters between processes.
Definition: Communicator.h:66
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: TaggedObject.cpp:124
FEM_ObjectBroker is is an object broker class for the finite element method.
Definition: FEM_ObjectBroker.h:151
Element creation manager.
Definition: ElementHandler.h:40
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: TaggedObject.cpp:132
Objet that can execute python scripts.
Definition: CommandEntity.h:40
bool isEqual(const TaggedObject &) const
Return true if both objects are equal.
Definition: TaggedObject.cpp:91
void setTag(int newTag)
Set tag.
Definition: TaggedObject.cpp:111
void assignTag(int newTag)
Set tag (to be called from Python interface).
Definition: TaggedObject.cpp:115
virtual TaggedObject * getCopy(void) const
Virtual constructor.
Definition: TaggedObject.cpp:83
Object idenfied by an integer (tag).
Definition: TaggedObject.h:92
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
int getTag(void) const
Returns the tag associated with the object.
Definition: TaggedObject.h:119
TaggedObject(int tag, CommandEntity *owr=nullptr)
Constructor.
Definition: TaggedObject.cpp:79