Use 'explicit' for constructors.

This commit is contained in:
Gunnar Beutner 2013-03-14 23:52:52 +01:00
parent 5bba6bd2ac
commit 7c46bb4f7d
36 changed files with 48 additions and 44 deletions

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<Application> Ptr; typedef shared_ptr<Application> Ptr;
typedef weak_ptr<Application> WeakPtr; typedef weak_ptr<Application> WeakPtr;
Application(const Dictionary::Ptr& serializedUpdate); explicit Application(const Dictionary::Ptr& serializedUpdate);
~Application(void); ~Application(void);
static Application::Ptr GetInstance(void); static Application::Ptr GetInstance(void);

View File

@ -29,7 +29,7 @@ public:
typedef shared_ptr<Connection> Ptr; typedef shared_ptr<Connection> Ptr;
typedef weak_ptr<Connection> WeakPtr; typedef weak_ptr<Connection> WeakPtr;
Connection(const Stream::Ptr& stream); explicit Connection(const Stream::Ptr& stream);
Stream::Ptr GetStream(void) const; Stream::Ptr GetStream(void) const;

View File

@ -41,7 +41,6 @@ public:
typedef AttributeMap::iterator AttributeIterator; typedef AttributeMap::iterator AttributeIterator;
typedef AttributeMap::const_iterator AttributeConstIterator; typedef AttributeMap::const_iterator AttributeConstIterator;
DynamicObject(const Dictionary::Ptr& serializedObject);
~DynamicObject(void); ~DynamicObject(void);
static void Initialize(void); static void Initialize(void);
@ -95,6 +94,8 @@ public:
static double GetCurrentTx(void); static double GetCurrentTx(void);
protected: protected:
explicit DynamicObject(const Dictionary::Ptr& serializedObject);
virtual void OnRegistrationCompleted(void); virtual void OnRegistrationCompleted(void);
virtual void OnUnregistrationCompleted(void); virtual void OnUnregistrationCompleted(void);

View File

@ -41,9 +41,6 @@ public:
void Start(void); void Start(void);
/*const void *GetReadBuffer(void) const;
void *GetWriteBuffer(size_t *count);*/
size_t GetAvailableBytes(void) const; size_t GetAvailableBytes(void) const;
size_t Peek(void *buffer, size_t count); size_t Peek(void *buffer, size_t count);
size_t Read(void *buffer, size_t count); size_t Read(void *buffer, size_t count);

View File

@ -26,10 +26,10 @@ REGISTER_TYPE(Logger);
/** /**
* Constructor for the Logger class. * Constructor for the Logger class.
* *
* @param properties A serialized dictionary containing attributes. * @param serializedUpdate A serialized dictionary containing attributes.
*/ */
Logger::Logger(const Dictionary::Ptr& properties) Logger::Logger(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("type", Attribute_Config, &m_Type); RegisterAttribute("type", Attribute_Config, &m_Type);
RegisterAttribute("path", Attribute_Config, &m_Path); RegisterAttribute("path", Attribute_Config, &m_Path);

View File

@ -87,7 +87,7 @@ public:
typedef shared_ptr<Logger> Ptr; typedef shared_ptr<Logger> Ptr;
typedef weak_ptr<Logger> WeakPtr; typedef weak_ptr<Logger> WeakPtr;
Logger(const Dictionary::Ptr& properties); explicit Logger(const Dictionary::Ptr& serializedUpdate);
static void Write(LogSeverity severity, const String& facility, static void Write(LogSeverity severity, const String& facility,
const String& message); const String& message);

View File

@ -38,7 +38,7 @@ public:
typedef function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback; typedef function<void (const shared_ptr<ScriptTask>&, const vector<Value>& arguments)> Callback;
ScriptFunction(const Callback& function); explicit ScriptFunction(const Callback& function);
static void Register(const String& name, const ScriptFunction::Ptr& function); static void Register(const String& name, const ScriptFunction::Ptr& function);
static void Unregister(const String& name); static void Unregister(const String& name);

View File

@ -33,7 +33,7 @@ class StackTrace
public: public:
StackTrace(void); StackTrace(void);
#ifdef _WIN32 #ifdef _WIN32
StackTrace(PEXCEPTION_POINTERS exi); explicit StackTrace(PEXCEPTION_POINTERS exi);
#endif /* _WIN32 */ #endif /* _WIN32 */
void Print(ostream& fp, int ignoreFrames = 0) const; void Print(ostream& fp, int ignoreFrames = 0) const;

View File

@ -35,7 +35,7 @@ public:
typedef weak_ptr<StreamLogger> WeakPtr; typedef weak_ptr<StreamLogger> WeakPtr;
StreamLogger(void); StreamLogger(void);
StreamLogger(ostream *stream); explicit StreamLogger(ostream *stream);
~StreamLogger(void); ~StreamLogger(void);
void OpenFile(const String& filename); void OpenFile(const String& filename);

View File

@ -34,7 +34,7 @@ class I2_CONFIG_API ConfigCompiler
public: public:
typedef function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc; typedef function<void (const String&, bool, const DebugInfo&)> HandleIncludeFunc;
ConfigCompiler(const String& path, istream *input = &cin, explicit ConfigCompiler(const String& path, istream *input = &cin,
HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude); HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude);
virtual ~ConfigCompiler(void); virtual ~ConfigCompiler(void);

View File

@ -36,7 +36,7 @@ public:
typedef weak_ptr<ConfigItemBuilder> WeakPtr; typedef weak_ptr<ConfigItemBuilder> WeakPtr;
ConfigItemBuilder(void); ConfigItemBuilder(void);
ConfigItemBuilder(const DebugInfo& debugInfo); explicit ConfigItemBuilder(const DebugInfo& debugInfo);
void SetType(const String& type); void SetType(const String& type);
void SetName(const String& name); void SetName(const String& name);

View File

@ -188,7 +188,7 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
{ {
BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) { BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) {
BOOST_FOREACH(const String& require, ruleList->GetRequires()) { BOOST_FOREACH(const String& require, ruleList->GetRequires()) {
long index = Convert::ToLong(require); size_t index = Convert::ToLong(require);
locations.push_back("Attribute '" + require + "'"); locations.push_back("Attribute '" + require + "'");

View File

@ -32,7 +32,7 @@ class I2_ICINGA_API CheckResultMessage : public MessagePart
{ {
public: public:
CheckResultMessage(void) : MessagePart() { } CheckResultMessage(void) : MessagePart() { }
CheckResultMessage(const MessagePart& message) : MessagePart(message) { } explicit CheckResultMessage(const MessagePart& message) : MessagePart(message) { }
String GetService(void) const; String GetService(void) const;
void SetService(const String& service); void SetService(const String& service);

View File

@ -39,6 +39,8 @@ public:
static int GetPassiveChecksStatistics(long timespan); static int GetPassiveChecksStatistics(long timespan);
private: private:
CIB(void);
static boost::mutex m_Mutex; static boost::mutex m_Mutex;
static RingBuffer m_ActiveChecksStatistics; static RingBuffer m_ActiveChecksStatistics;
static RingBuffer m_PassiveChecksStatistics; static RingBuffer m_PassiveChecksStatistics;

View File

@ -30,8 +30,8 @@ REGISTER_SCRIPTFUNCTION(ValidateServiceDictionary, &Host::ValidateServiceDiction
REGISTER_TYPE(Host); REGISTER_TYPE(Host);
Host::Host(const Dictionary::Ptr& properties) Host::Host(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups); RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups);

View File

@ -59,7 +59,7 @@ public:
typedef shared_ptr<Host> Ptr; typedef shared_ptr<Host> Ptr;
typedef weak_ptr<Host> WeakPtr; typedef weak_ptr<Host> WeakPtr;
Host(const Dictionary::Ptr& properties); explicit Host(const Dictionary::Ptr& serializedUpdate);
~Host(void); ~Host(void);
static Host::Ptr GetByName(const String& name); static Host::Ptr GetByName(const String& name);

View File

@ -28,8 +28,8 @@ Timer::Ptr HostGroup::m_MembersCacheTimer;
REGISTER_TYPE(HostGroup); REGISTER_TYPE(HostGroup);
HostGroup::HostGroup(const Dictionary::Ptr& properties) HostGroup::HostGroup(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
RegisterAttribute("notes_url", Attribute_Config, &m_NotesUrl); RegisterAttribute("notes_url", Attribute_Config, &m_NotesUrl);

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<HostGroup> Ptr; typedef shared_ptr<HostGroup> Ptr;
typedef weak_ptr<HostGroup> WeakPtr; typedef weak_ptr<HostGroup> WeakPtr;
HostGroup(const Dictionary::Ptr& properties); explicit HostGroup(const Dictionary::Ptr& serializedUpdate);
~HostGroup(void); ~HostGroup(void);
static HostGroup::Ptr GetByName(const String& name); static HostGroup::Ptr GetByName(const String& name);

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<IcingaApplication> Ptr; typedef shared_ptr<IcingaApplication> Ptr;
typedef weak_ptr<IcingaApplication> WeakPtr; typedef weak_ptr<IcingaApplication> WeakPtr;
IcingaApplication(const Dictionary::Ptr& serializedUpdate); explicit IcingaApplication(const Dictionary::Ptr& serializedUpdate);
int Main(void); int Main(void);

View File

@ -35,6 +35,8 @@ public:
static Dictionary::Ptr MergeMacroDicts(const vector<Dictionary::Ptr>& macroDicts); static Dictionary::Ptr MergeMacroDicts(const vector<Dictionary::Ptr>& macroDicts);
private: private:
MacroProcessor(void);
static String InternalResolveMacros(const String& str, const Dictionary::Ptr& macros); static String InternalResolveMacros(const String& str, const Dictionary::Ptr& macros);
}; };

View File

@ -23,8 +23,8 @@ using namespace icinga;
REGISTER_TYPE(Notification); REGISTER_TYPE(Notification);
Notification::Notification(const Dictionary::Ptr& properties) Notification::Notification(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("notification_command", Attribute_Config, &m_NotificationCommand); RegisterAttribute("notification_command", Attribute_Config, &m_NotificationCommand);
RegisterAttribute("macros", Attribute_Config, &m_Macros); RegisterAttribute("macros", Attribute_Config, &m_Macros);

View File

@ -52,7 +52,7 @@ public:
typedef shared_ptr<Notification> Ptr; typedef shared_ptr<Notification> Ptr;
typedef weak_ptr<Notification> WeakPtr; typedef weak_ptr<Notification> WeakPtr;
Notification(const Dictionary::Ptr& properties); explicit Notification(const Dictionary::Ptr& serializedUpdate);
~Notification(void); ~Notification(void);
static Notification::Ptr GetByName(const String& name); static Notification::Ptr GetByName(const String& name);

View File

@ -32,7 +32,7 @@ class I2_ICINGA_API NotificationRequestMessage : public MessagePart
{ {
public: public:
NotificationRequestMessage(void) : MessagePart() { } NotificationRequestMessage(void) : MessagePart() { }
NotificationRequestMessage(const MessagePart& message) : MessagePart(message) { } explicit NotificationRequestMessage(const MessagePart& message) : MessagePart(message) { }
String GetService(void) const; String GetService(void) const;
void SetService(const String& service); void SetService(const String& service);

View File

@ -32,6 +32,9 @@ class I2_ICINGA_API NullCheckTask
{ {
public: public:
static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments); static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments);
private:
NullCheckTask(void);
}; };
} }

View File

@ -34,7 +34,6 @@ public:
static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments); static void ScriptFunc(const ScriptTask::Ptr& task, const vector<Value>& arguments);
private: private:
static void ProcessFinishedHandler(PluginNotificationTask ct); static void ProcessFinishedHandler(PluginNotificationTask ct);
PluginNotificationTask(const ScriptTask::Ptr& task, const Process::Ptr& process, PluginNotificationTask(const ScriptTask::Ptr& task, const Process::Ptr& process,

View File

@ -75,7 +75,7 @@ public:
typedef shared_ptr<Service> Ptr; typedef shared_ptr<Service> Ptr;
typedef weak_ptr<Service> WeakPtr; typedef weak_ptr<Service> WeakPtr;
Service(const Dictionary::Ptr& properties); explicit Service(const Dictionary::Ptr& serializedUpdate);
~Service(void); ~Service(void);
static Service::Ptr GetByName(const String& name); static Service::Ptr GetByName(const String& name);

View File

@ -28,8 +28,8 @@ Timer::Ptr ServiceGroup::m_MembersCacheTimer;
REGISTER_TYPE(ServiceGroup); REGISTER_TYPE(ServiceGroup);
ServiceGroup::ServiceGroup(const Dictionary::Ptr& properties) ServiceGroup::ServiceGroup(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
RegisterAttribute("notes_url", Attribute_Config, &m_NotesUrl); RegisterAttribute("notes_url", Attribute_Config, &m_NotesUrl);

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<ServiceGroup> Ptr; typedef shared_ptr<ServiceGroup> Ptr;
typedef weak_ptr<ServiceGroup> WeakPtr; typedef weak_ptr<ServiceGroup> WeakPtr;
ServiceGroup(const Dictionary::Ptr& properties); explicit ServiceGroup(const Dictionary::Ptr& serializedUpdate);
~ServiceGroup(void); ~ServiceGroup(void);
static ServiceGroup::Ptr GetByName(const String& name); static ServiceGroup::Ptr GetByName(const String& name);

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<TimePeriod> Ptr; typedef shared_ptr<TimePeriod> Ptr;
typedef weak_ptr<TimePeriod> WeakPtr; typedef weak_ptr<TimePeriod> WeakPtr;
TimePeriod(const Dictionary::Ptr& serializedUpdate); explicit TimePeriod(const Dictionary::Ptr& serializedUpdate);
static TimePeriod::Ptr GetByName(const String& name); static TimePeriod::Ptr GetByName(const String& name);

View File

@ -23,8 +23,8 @@ using namespace icinga;
REGISTER_TYPE(User); REGISTER_TYPE(User);
User::User(const Dictionary::Ptr& properties) User::User(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
RegisterAttribute("macros", Attribute_Config, &m_Macros); RegisterAttribute("macros", Attribute_Config, &m_Macros);

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<User> Ptr; typedef shared_ptr<User> Ptr;
typedef weak_ptr<User> WeakPtr; typedef weak_ptr<User> WeakPtr;
User(const Dictionary::Ptr& properties); explicit User(const Dictionary::Ptr& serializedUpdate);
~User(void); ~User(void);
static User::Ptr GetByName(const String& name); static User::Ptr GetByName(const String& name);

View File

@ -28,8 +28,8 @@ Timer::Ptr UserGroup::m_MembersCacheTimer;
REGISTER_TYPE(UserGroup); REGISTER_TYPE(UserGroup);
UserGroup::UserGroup(const Dictionary::Ptr& properties) UserGroup::UserGroup(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(properties) : DynamicObject(serializedUpdate)
{ {
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
} }

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<UserGroup> Ptr; typedef shared_ptr<UserGroup> Ptr;
typedef weak_ptr<UserGroup> WeakPtr; typedef weak_ptr<UserGroup> WeakPtr;
UserGroup(const Dictionary::Ptr& properties); explicit UserGroup(const Dictionary::Ptr& serializedUpdate);
~UserGroup(void); ~UserGroup(void);
static UserGroup::Ptr GetByName(const String& name); static UserGroup::Ptr GetByName(const String& name);

View File

@ -38,7 +38,7 @@ public:
typedef void (Callback)(const Endpoint::Ptr&, const Endpoint::Ptr&, const RequestMessage&); typedef void (Callback)(const Endpoint::Ptr&, const Endpoint::Ptr&, const RequestMessage&);
Endpoint(const Dictionary::Ptr& serializedUpdate); explicit Endpoint(const Dictionary::Ptr& serializedUpdate);
~Endpoint(void); ~Endpoint(void);
static Endpoint::Ptr GetByName(const String& name); static Endpoint::Ptr GetByName(const String& name);

View File

@ -34,7 +34,7 @@ public:
typedef shared_ptr<JsonRpcConnection> Ptr; typedef shared_ptr<JsonRpcConnection> Ptr;
typedef weak_ptr<JsonRpcConnection> WeakPtr; typedef weak_ptr<JsonRpcConnection> WeakPtr;
JsonRpcConnection(const Stream::Ptr& stream); explicit JsonRpcConnection(const Stream::Ptr& stream);
void SendMessage(const MessagePart& message); void SendMessage(const MessagePart& message);

View File

@ -36,8 +36,8 @@ class I2_REMOTING_API MessagePart
{ {
public: public:
MessagePart(void); MessagePart(void);
MessagePart(const Dictionary::Ptr& dictionary); explicit MessagePart(const Dictionary::Ptr& dictionary);
MessagePart(const MessagePart& message); explicit MessagePart(const MessagePart& message);
Dictionary::Ptr GetDictionary(void) const; Dictionary::Ptr GetDictionary(void) const;