11 #ifndef WRENCH_SERVICE_H
12 #define WRENCH_SERVICE_H
19 #include "wrench/simgrid_S4U_util/S4U_Daemon.h"
20 #include "wrench/services/ServiceProperty.h"
21 #include "wrench/services/ServiceMessagePayload.h"
23 typedef std::map<WRENCH_PROPERTY_TYPE,std::string> WRENCH_PROPERTY_COLLECTION_TYPE;
24 typedef std::unordered_map<WRENCH_MESSAGEPAYLOAD_TYPE ,double> WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE;
39 void start(std::shared_ptr<Service> this_service,
bool daemonize,
bool auto_restart);
95 void setProperty(WRENCH_PROPERTY_TYPE,
const std::string&);
97 void setProperties(WRENCH_PROPERTY_COLLECTION_TYPE default_property_values,
98 WRENCH_PROPERTY_COLLECTION_TYPE overriden_property_values);
103 void setMessagePayloads(WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values,
104 WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE overriden_messagepayload_values);
130 return std::dynamic_pointer_cast<T>(this->shared_from_this());
147 #endif //WRENCH_SERVICE_H
void setNetworkTimeoutValue(double value)
Sets the service's network timeout value.
Definition: Service.cpp:414
std::string getPropertyValueAsString(WRENCH_PROPERTY_TYPE)
Get a property of the Service as a string.
Definition: Service.cpp:86
WRENCH_PROPERTY_COLLECTION_TYPE property_list
The service's property list.
Definition: Service.h:110
void start(std::shared_ptr< Service > this_service, bool daemonize, bool auto_restart)
Start the service.
Definition: Service.cpp:207
void setStateToDown()
Set the state of the service to DOWN.
Definition: Service.cpp:351
bool getPropertyValueAsBoolean(WRENCH_PROPERTY_TYPE)
Get a property of the Service as a boolean.
Definition: Service.cpp:179
void setProperties(WRENCH_PROPERTY_COLLECTION_TYPE default_property_values, WRENCH_PROPERTY_COLLECTION_TYPE overriden_property_values)
Set default and user-defined properties.
Definition: Service.cpp:360
bool shutting_down
A boolean that indicates if the service is in the middle of shutting down.
Definition: Service.h:135
const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE & getMessagePayloadList() const
Get all message payloads and their values of the Service.
Definition: Service.cpp:168
double getPropertyValueAsDouble(WRENCH_PROPERTY_TYPE)
Get a property of the Service as a double.
Definition: Service.cpp:102
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list
The service's messagepayload list.
Definition: Service.h:113
std::string name
The service's name.
Definition: Service.h:116
void serviceSanityCheck()
Check whether the service is properly configured and running.
Definition: Service.cpp:397
void assertServiceIsUp()
Throws an exception if the service is not up.
Definition: Service.cpp:422
void setMessagePayload(WRENCH_MESSAGEPAYLOAD_TYPE, double)
Set a message payload of the Service.
Definition: Service.cpp:68
bool isUp()
Returns true if the service is UP, false otherwise.
Definition: Service.cpp:344
Definition: Action.cpp:28
void setMessagePayloads(WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values, WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE overriden_messagepayload_values)
Set default and user-defined message payloads.
Definition: Service.cpp:378
std::shared_ptr< T > getSharedPtr()
Method to retrieve the shared_ptr to a service.
Definition: Service.h:129
double getMessagePayloadValue(WRENCH_MESSAGEPAYLOAD_TYPE)
Get a message payload of the Service as a double.
Definition: Service.cpp:155
void suspend()
Suspend the service.
Definition: Service.cpp:294
~Service() override
Destructor.
Definition: Service.cpp:34
double network_timeout
The time (in seconds) after which a service that doesn't send back a reply (control) message causes a...
Definition: Service.h:121
void setProperty(WRENCH_PROPERTY_TYPE, const std::string &)
Set a property of the Service.
Definition: Service.cpp:53
virtual void stop()
Synchronously stop the service (does nothing if the service is already stopped)
Definition: Service.cpp:244
double getNetworkTimeoutValue()
Returns the service's network timeout value.
Definition: Service.cpp:405
A generic "running daemon" abstraction that serves as a basis for all simulated processes.
Definition: S4U_Daemon.h:32
std::string getPhysicalHostname()
Get the physical name of the host on which the service is / will be running.
Definition: Service.cpp:332
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:60
A class that provides basic simulation methods. Once the simulation object has been explicitly or imp...
Definition: Simulation.h:48
Service(std::string hostname, std::string process_name_prefix)
Constructor.
Definition: Service.cpp:43
unsigned long getPropertyValueAsUnsignedLong(WRENCH_PROPERTY_TYPE)
Get a property of the Service as an unsigned long.
Definition: Service.cpp:128
static void assertServiceIsUp(std::shared_ptr< Service > s)
Assert for the service being up.
Definition: Service.h:86
A service that can be added to the simulation and that can be used by a WMS when executing a workflow...
Definition: Service.h:31
std::string getHostname()
Get the name of the host on which the service is / will be running.
Definition: Service.cpp:324
void resume()
Resume the service.
Definition: Service.cpp:310