# PhasicFlow: src/phasicFlow/repository/IOobject/objectFile.hpp Source File

objectFile.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __objectFile_hpp__
#define __objectFile_hpp__
#include "types.hpp"
#include "fileSystem.hpp"
namespace pFlow
{
class objectFile
{
public:
enum readFlag
{
READ_ALWAYS,
READ_NEVER,
READ_IF_PRESENT
};
enum writeFlag
{
WRITE_ALWAYS,
WRITE_NEVER
};
protected:
// name of the entity
word name_;
// read flag
readFlag rFlag_;
// write flag
writeFlag wFlag_;
// local path of entity
fileSystem localPath_;
bool readWriteHeader_ = true;
public:
// constructors
objectFile
(
const word& name
);
objectFile
(
const word& name,
const fileSystem& localPath,
const readFlag& rf = READ_NEVER,
const writeFlag& wf = WRITE_NEVER,
bool rwHeader = true
);
// copy construct
objectFile( const objectFile & src) = default;
objectFile( objectFile&& src) = default;
objectFile& operator = (const objectFile & rhs) = default;
objectFile& operator = (objectFile && rhs) = default;
virtual ~objectFile()=default;
virtual word name() const
{
return name_;
}
virtual fileSystem localPath()const
{
return localPath_;
}
readFlag rFlag()const
{
return rFlag_;
}
writeFlag wFlag()const
{
return wFlag_;
}
bool isReadAlways()const
{
return rFlag_ == READ_ALWAYS;
}
bool isReadNever()const
{
return rFlag_ == READ_NEVER;
}
bool isReadIfPresent()const
{
return rFlag_ == READ_IF_PRESENT;
}
bool isWriteAlways()const
{
return wFlag_ == WRITE_ALWAYS;
}
bool isWriteNever()const
{
return wFlag_ == WRITE_NEVER;
}
bool readWriteHeader()const
{
return readWriteHeader_;
}
};
}
#endif //__objectFile_hpp__
pFlow::objectFile::~objectFile
virtual ~objectFile()=default
pFlow::objectFile::objectFile
objectFile(const word &name)
Definition: objectFile.cpp:24
types.hpp
pFlow::objectFile::isReadNever
bool isReadNever() const
Definition: objectFile.hpp:122
pFlow::objectFile::isWriteNever
bool isWriteNever() const
Definition: objectFile.hpp:137
pFlow::objectFile::readFlag
readFlag
Definition: objectFile.hpp:37
pFlow::objectFile::isReadAlways
bool isReadAlways() const
Definition: objectFile.hpp:117
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::objectFile::localPath_
fileSystem localPath_
Definition: objectFile.hpp:62
pFlow::objectFile::WRITE_ALWAYS
@ WRITE_ALWAYS
Definition: objectFile.hpp:46
pFlow::objectFile::writeFlag
writeFlag
Definition: objectFile.hpp:44
fileSystem.hpp
pFlow
Definition: demComponent.hpp:28
pFlow::objectFile::WRITE_NEVER
@ WRITE_NEVER
Definition: objectFile.hpp:47
pFlow::fileSystem
Definition: fileSystem.hpp:63
pFlow::objectFile::rFlag_
readFlag rFlag_
Definition: objectFile.hpp:56
pFlow::objectFile::operator=
objectFile & operator=(const objectFile &rhs)=default
pFlow::objectFile::READ_ALWAYS
@ READ_ALWAYS
Definition: objectFile.hpp:39
pFlow::objectFile::readWriteHeader
bool readWriteHeader() const
Definition: objectFile.hpp:142
pFlow::objectFile::name
virtual word name() const
Definition: objectFile.hpp:97
pFlow::objectFile
Definition: objectFile.hpp:33
pFlow::objectFile::readWriteHeader_
bool readWriteHeader_
Definition: objectFile.hpp:64
pFlow::objectFile::isWriteAlways
bool isWriteAlways() const
Definition: objectFile.hpp:132
pFlow::objectFile::READ_NEVER
@ READ_NEVER
Definition: objectFile.hpp:40
pFlow::objectFile::isReadIfPresent
bool isReadIfPresent() const
Definition: objectFile.hpp:127
pFlow::objectFile::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition: objectFile.hpp:41
pFlow::objectFile::localPath
virtual fileSystem localPath() const
Definition: objectFile.hpp:102
pFlow::objectFile::name_
word name_
Definition: objectFile.hpp:53
pFlow::objectFile::wFlag
writeFlag wFlag() const
Definition: objectFile.hpp:112
pFlow::objectFile::wFlag_
writeFlag wFlag_
Definition: objectFile.hpp:59
pFlow::objectFile::rFlag
readFlag rFlag() const
Definition: objectFile.hpp:107