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 weak_ptr<Application> WeakPtr;
Application(const Dictionary::Ptr& serializedUpdate);
explicit Application(const Dictionary::Ptr& serializedUpdate);
~Application(void);
static Application::Ptr GetInstance(void);

View File

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

View File

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

View File

@ -41,9 +41,6 @@ public:
void Start(void);
/*const void *GetReadBuffer(void) const;
void *GetWriteBuffer(size_t *count);*/
size_t GetAvailableBytes(void) const;
size_t Peek(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.
*
* @param properties A serialized dictionary containing attributes.
* @param serializedUpdate A serialized dictionary containing attributes.
*/
Logger::Logger(const Dictionary::Ptr& properties)
: DynamicObject(properties)
Logger::Logger(const Dictionary::Ptr& serializedUpdate)
: DynamicObject(serializedUpdate)
{
RegisterAttribute("type", Attribute_Config, &m_Type);
RegisterAttribute("path", Attribute_Config, &m_Path);

View File

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

View File

@ -38,7 +38,7 @@ public:
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 Unregister(const String& name);

View File

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

View File

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

View File

@ -34,7 +34,7 @@ class I2_CONFIG_API ConfigCompiler
public:
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);
virtual ~ConfigCompiler(void);

View File

@ -36,7 +36,7 @@ public:
typedef weak_ptr<ConfigItemBuilder> WeakPtr;
ConfigItemBuilder(void);
ConfigItemBuilder(const DebugInfo& debugInfo);
explicit ConfigItemBuilder(const DebugInfo& debugInfo);
void SetType(const String& type);
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 String& require, ruleList->GetRequires()) {
long index = Convert::ToLong(require);
size_t index = Convert::ToLong(require);
locations.push_back("Attribute '" + require + "'");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,6 +32,9 @@ class I2_ICINGA_API NullCheckTask
{
public:
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);
private:
static void ProcessFinishedHandler(PluginNotificationTask ct);
PluginNotificationTask(const ScriptTask::Ptr& task, const Process::Ptr& process,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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