Go to the documentation of this file.
32 localPath_(localPath),
46 objcs.second->releaseOwner(
true);
50 reps.second->releaseOwner(
true);
74 return owner_->
path()/localPath();
104 if( !repositories_.insertIf(rep->
name(), rep) )
108 "Failed to add repository " << rep->
name() <<
109 " to repository " << this->name() <<
110 ". It is already in this repository. \n";
120 auto name = rep->
name();
121 return repositories_.erase(name) == 1;
126 auto name = io->
name();
127 return objects_.erase(name) == 1;
134 if(old && !fromOwner)
144 if( !objects_.insertIf(io->
name(), io ) )
147 "Failed to add object " << io->
name() <<
148 " with type "<< lookupObjectTypeName(io->
name())<<
149 " to repository " << this->name() <<
150 ". It is already in this repository. \n";
159 return objects_.search(nm);
167 if(
auto [iter, found] = objects_.findIf(nm); found)
169 return iter->second->typeName();
174 "Object name " << nm <<
" is not found in repository "<< name() <<
endl;
191 auto* owner =
object->
owner();
197 owner =
object->
owner();
203 if( lookupObjectName(nm) )
return true;
205 for(
auto& rep:repositories_ )
209 if(rep.second->globalLookupObjectName(nm,
true))
return true;
219 return repositories_.search(nm);
224 if(lookupObjectName(nm))
return true;
225 if(lookupRepositoryName(nm))
return true;
231 return objects_.size();
236 return repositories_.size();
242 if(
auto [iter, success] = repositories_.findIf(name); success )
244 return *iter->second;
249 "repository with name " << name <<
" is not found in repository " << this->name()<<
endl <<
250 "list of avaiable repositories is \n" << repositoryNames();
252 return *iter->second;
259 for(
auto& ob:objects_)
261 names.push_back(ob.first);
269 for(
auto& rep:repositories_)
271 names.push_back(rep.first);
283 for(
const auto& obj:objects_)
287 if(obj.second->implyWrite())
291 if(!obj.second->writeObject())
298 for(
auto& rep:repositories_)
303 if(! rep.second->write(verbose) )
306 " error in writing repository " << rep.first <<
endl;
313 " repository " << rep.first <<
" is not a valid object to be referenced. \n";
repository * releaseOwner(bool fromOwner=false)
virtual fileSystem localPath() const
#define fatalExit
Fatal exit.
#define warningInFunction
Report a warning.
wordMap< repository * > repositories_
const repository * owner() const
bool lookupObjectName(const word &nm) const
word lookupObjectTypeName(const word &nm) const
iOstream & endl(iOstream &os)
Add newline and flush stream.
size_t numRepositories() const
virtual bool write(bool verbose=false) const
bool lookupRepositoryName(const word &nm) const
Manages file pathes, manupulate and combines them.
bool globalLookupObjectName(const word &nm, bool downward=false) const
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
const pathType & path() const
Const access to path.
wordList repositoryNames() const
virtual const word & name() const
const repository & thisRepository() const
wordMap< IOobject * > objects_
repository(const word &name, const fileSystem &localPath, repository *owner=nullptr)
bool addToRepository(repository *rep)
add repository to this repository return false if the name already exists
virtual fileSystem path() const
bool removeFromRepository(repository *rep)
remove rep from the list of repositories
bool lookupName(const word nm) const
repository & lookupRepository(const word &name)
size_t numObjects() const
wordList objectNames() const