OpenStructure
entity_base.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_ENTITY_BASE_HT
20 #define OST_ENTITY_BASE_HT
21 
22 #include <ost/mol/module_config.hh>
24 
25 #include <ost/generic_property.hh>
26 
27 namespace ost { namespace mol {
28 
31  public GenericPropContainer<EntityBase> {
32 public:
36 
40  const String& GetName() const;
41 
47  void SetName(const String& ent_name);
48 
49 public:
50 
52 
53  operator bool() const { return this->IsValid(); }
62  bool IsValid() const { return Impl().get()!=0; }
64  const impl::EntityImplPtr& Impl() const;
65 protected:
66 
68 
70 
71  void CheckValidity() const;
72 private:
73  impl::EntityImplPtr impl_;
74 };
75 
76 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os,
77  const EntityBase& ent);
78 }} // ns
79 
80 #endif // OST_ENTITY_BASE_HH
81 
base class for the handler classes
base class for the implementation
definition of EntityBase
Definition: entity_base.hh:31
void SetName(const String &ent_name)
Set entity name.
void CheckValidity() const
EntityBase(const impl::EntityImplPtr &impl)
impl::EntityImplPtr & Impl()
GenericPropContainerImpl * GpImpl()
const impl::EntityImplPtr & Impl() const
bool IsValid() const
check validity of handle
Definition: entity_base.hh:62
const GenericPropContainerImpl * GpImpl() const
const String & GetName() const
Get entity name.
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_MOL
boost::shared_ptr< EntityImpl > EntityImplPtr
DLLEXPORT_OST_MOL std::ostream & operator<<(std::ostream &os, const AtomBase &atom)
Definition: base.dox:1