www.cemf.ir
IOobject.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 
22 #ifndef __IOobject_hpp__
23 #define __IOobject_hpp__
24 
25 
26 
27 #include "IOfileHeader.hpp"
28 #include "IOPattern.hpp"
29 
30 namespace pFlow
31 {
32 
33 class repository;
34 
35 class IOobject
36 :
37  public IOfileHeader
38 {
39 private:
40 
42 
43  mutable repository* owner_;
44 
45 public:
46 
47  // - typeinfo
48  virtual
49  word typeName() const = 0;
50 
52 
53  // - construct from components, transfer the ownership of iObject (object_t) to the
54  // onwner and read the object from file
55  IOobject(
56  const objectFile& objf,
57  const IOPattern& iop,
58  repository* owner);
59 
60  ~IOobject() override;
61 
62  // - copy construct
63  IOobject(const IOobject& src)=delete;
64 
65  // - move construct
66  IOobject(IOobject&& src) = delete;
67 
68 
69  inline
70  const IOPattern& ioPattern()const
71  {
72  return ioPattern_;
73  }
74 
75  // - pointer to owner repository
76  const repository* owner()const override
77  {
78  return owner_;
79  }
80 
82  {
83  return owner_;
84  }
85 
86  repository* releaseOwner(bool fromOwner = false);
87 
88 
89  bool isIncluded(const word& objName)const override;
90 
91  bool isExcluded(const word& objName)const override;
92 
93 
95 
96  // - read from file
97  bool readObject(bool rdHdr = true);
98 
99  // - write to file
100  bool writeObject() const;
101 
102  // - read from istream
103  bool readObject(iIstream& is, bool rdHdr = true);
104 
105  // - write to istream
106  bool writeObject(iOstream& os) const;
107 
108  virtual
109  bool write(iOstream& is, const IOPattern& iop)const = 0;
110 
111  virtual
112  bool read(iIstream& is, const IOPattern& iop) = 0;
113 
114 };
115 
116 }
117 
118 #include "IOobjectTemplates.cpp"
119 
120 #endif //__IOobject_hpp__
pFlow::IOobject::isExcluded
bool isExcluded(const word &objName) const override
Definition: IOobject.cpp:76
pFlow::IOobject::~IOobject
~IOobject() override
Definition: IOobject.cpp:46
IOobjectTemplates.cpp
pFlow::IOobject::isIncluded
bool isIncluded(const word &objName) const override
Definition: IOobject.cpp:68
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::IOobject::write
virtual bool write(iOstream &is, const IOPattern &iop) const =0
pFlow::IOobject::read
virtual bool read(iIstream &is, const IOPattern &iop)=0
pFlow
Definition: demGeometry.hpp:27
pFlow::IOobject
Definition: IOobject.hpp:35
pFlow::IOobject::ioPattern
const IOPattern & ioPattern() const
Definition: IOobject.hpp:70
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::IOobject::readObject
bool readObject(bool rdHdr=true)
Definition: IOobject.cpp:83
pFlow::IOobject::IOobject
IOobject(const objectFile &objf, const IOPattern &iop, repository *owner)
Definition: IOobject.cpp:26
pFlow::IOPattern
Definition: IOPattern.hpp:32
pFlow::IOobject::owner
repository * owner()
Definition: IOobject.hpp:81
pFlow::IOobject::owner
const repository * owner() const override
Definition: IOobject.hpp:76
pFlow::IOobject::ioPattern_
IOPattern ioPattern_
Definition: IOobject.hpp:41
pFlow::objectFile
Definition: objectFile.hpp:30
IOfileHeader.hpp
pFlow::IOobject::releaseOwner
repository * releaseOwner(bool fromOwner=false)
Definition: IOobject.cpp:55
IOPattern.hpp
pFlow::IOfileHeader
Definition: IOfileHeader.hpp:35
pFlow::repository
Definition: repository.hpp:34
pFlow::IOobject::owner_
repository * owner_
Definition: IOobject.hpp:43
pFlow::IOobject::writeObject
bool writeObject() const
Definition: IOobject.cpp:119
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::IOobject::typeName
virtual word typeName() const =0