Browse Source

Test: PityTest - AbstractPityUnit add setExecMode()

master
heck 4 years ago
parent
commit
f8a579fd99
  1. 10
      src/AbstractPityUnit.cc
  2. 6
      src/AbstractPityUnit.hh

10
src/AbstractPityUnit.cc

@ -42,8 +42,8 @@ namespace pEp {
{ {
_procUnitNr = rhs._procUnitNr; _procUnitNr = rhs._procUnitNr;
_exec_mode = rhs._exec_mode; _exec_mode = rhs._exec_mode;
_transport = rhs._transport; _transport = rhs._transport; // Will re-initialized in run()
_transport_endpoints = rhs._transport_endpoints; _transport_endpoints = rhs._transport_endpoints; // Will re-initialized in run()
_init(); _init();
} }
@ -75,6 +75,10 @@ namespace pEp {
return AbstractPityUnit::_global_root_dir; return AbstractPityUnit::_global_root_dir;
} }
void AbstractPityUnit::setExecMode(AbstractPityUnit::ExecutionMode execMode)
{
_exec_mode = execMode;
}
// For: // For:
// RootUnit - "<name>" // RootUnit - "<name>"
@ -412,7 +416,7 @@ namespace pEp {
std::string AbstractPityUnit::_status_string(const std::string &msg) const std::string AbstractPityUnit::_status_string(const std::string &msg) const
{ {
std::string ret; std::string ret;
ret = "[ " + to_string(_exec_mode) + ":" + std::to_string(getpid()) + " ] [ " + ret = "[ " + to_string(_exec_mode) + ": " + std::to_string(getpid()) + " ] [ " +
getPathShort() + " ] [ " + msg + " ]"; getPathShort() + " ] [ " + msg + " ]";
return ret; return ret;
} }

6
src/AbstractPityUnit.hh

@ -53,6 +53,7 @@ namespace pEp {
// Read-Write // Read-Write
static void setGlobalRootDir(const std::string& dir); static void setGlobalRootDir(const std::string& dir);
static std::string getGlobalRootDir(); static std::string getGlobalRootDir();
void setExecMode(ExecutionMode execMode);
// Read-Only // Read-Only
std::string getPathShort() const; std::string getPathShort() const;
@ -113,13 +114,14 @@ namespace pEp {
// Fields // Fields
// ------ // ------
static std::string _global_root_dir; static std::string _global_root_dir;
int _procUnitNr;
ExecutionMode _exec_mode; ExecutionMode _exec_mode;
int _procUnitNr;
static int _procUnitsCount; // will be increased in every constructor static int _procUnitsCount; // will be increased in every constructor
// transport // transport
std::shared_ptr<PityTransport> _transport; //only ever read via transport() std::shared_ptr<PityTransport> _transport; //only ever read via transport()
// TODO move endpoints into PityTransport // TODO move endpoints into PityTransport
Endpoints _transport_endpoints; // only ever access via transportEndpoints() Endpoints _transport_endpoints; // only ever access via transportEndpoints()
// fs-mutex to sync across processes // fs-mutex to sync across processes
std::shared_ptr<fs_mutex> _log_mutex = nullptr; std::shared_ptr<fs_mutex> _log_mutex = nullptr;

Loading…
Cancel
Save