extern EventLoop_t eventLoop;
// Find the requested service by name
-static ServiceRecord * findService(const std::list<ServiceRecord *> & records,
+static ServiceRecord * find_service(const std::list<ServiceRecord *> & records,
const char *name) noexcept
{
using std::list;
return (ServiceRecord *)0;
}
-ServiceRecord * ServiceSet::findService(const std::string &name) noexcept
+ServiceRecord * ServiceSet::find_service(const std::string &name) noexcept
{
- return ::findService(records, name.c_str());
+ return ::find_service(records, name.c_str());
}
void ServiceSet::startService(const char *name)
void ServiceSet::stopService(const std::string & name) noexcept
{
- ServiceRecord *record = findService(name);
+ ServiceRecord *record = find_service(name);
if (record != nullptr) {
record->stop();
processQueues(false);
void ServiceRecord::queueForConsole() noexcept
{
- service_set->consoleQueueTail(this);
+ service_set->append_console_queue(this);
}
void ServiceRecord::releaseConsole() noexcept
const char *excDescription;
protected:
- ServiceLoadExc(std::string serviceName) noexcept
- : serviceName(serviceName)
+ ServiceLoadExc(std::string serviceName, const char *desc) noexcept
+ : serviceName(serviceName), excDescription(desc)
{
}
};
{
public:
ServiceNotFound(std::string serviceName) noexcept
- : ServiceLoadExc(serviceName)
+ : ServiceLoadExc(serviceName, "Service description not found.")
{
- excDescription = "Service description not found.";
}
};
{
public:
ServiceCyclicDependency(std::string serviceName) noexcept
- : ServiceLoadExc(serviceName)
+ : ServiceLoadExc(serviceName, "Has cyclic dependency.")
{
- excDescription = "Has cyclic dependency.";
}
};
class ServiceDescriptionExc : public ServiceLoadExc
{
public:
- std::string extraInfo;
-
ServiceDescriptionExc(std::string serviceName, std::string extraInfo) noexcept
- : ServiceLoadExc(serviceName), extraInfo(extraInfo)
+ : ServiceLoadExc(serviceName, extraInfo.c_str())
{
- excDescription = extraInfo.c_str();
}
};
void startService(const char *name);
// Locate an existing service record.
- ServiceRecord *findService(const std::string &name) noexcept;
+ ServiceRecord *find_service(const std::string &name) noexcept;
// Find a loaded service record, or load it if it is not loaded.
// Throws:
// std::bad_alloc on out-of-memory condition
ServiceRecord *loadService(const std::string &name)
{
- ServiceRecord *record = findService(name);
+ ServiceRecord *record = find_service(name);
if (record == nullptr) {
record = loadServiceRecord(name.c_str());
}
}
// Set the console queue tail (returns previous tail)
- ServiceRecord * consoleQueueTail(ServiceRecord * newTail) noexcept
+ ServiceRecord * append_console_queue(ServiceRecord * newTail) noexcept
{
auto prev_tail = console_queue_tail;
console_queue_tail = newTail;