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-2011 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:
34  EntityBase(const impl::EntityImplPtr& impl);
35  EntityBase();
36 
40  const String& GetName() const;
41 
47  void SetName(const String& ent_name);
48 
49 public:
50 
52 
53 
54 
55 
56 
57 
58 
59  operator bool() const { return this->IsValid(); }
62  bool IsValid() const { return Impl().get()!=0; }
63  impl::EntityImplPtr& Impl();
64  const impl::EntityImplPtr& Impl() const;
65 protected:
66 
67  GenericPropContainerImpl* GpImpl();
68 
69  const GenericPropContainerImpl* GpImpl() const;
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