Skip to content

Commit

Permalink
enh(engine): Service/Host/Anomalydetection configuration objects simp…
Browse files Browse the repository at this point in the history
…lified

REFS: MON-113242
  • Loading branch information
bouda1 authored Jun 10, 2024
1 parent 69c90d4 commit 063a994
Show file tree
Hide file tree
Showing 36 changed files with 426 additions and 673 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class anomalydetection : public object {
opt<uint64_t> _severity_id;
opt<uint64_t> _icon_id;
std::set<std::pair<uint64_t, uint16_t>> _tags;
opt<double> _sensitivity;
double _sensitivity;
};

typedef std::shared_ptr<anomalydetection> anomalydetection_ptr;
Expand Down
41 changes: 20 additions & 21 deletions engine/inc/com/centreon/engine/configuration/command.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*
** Copyright 2011-2013,2017 Centreon
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2011-2013,2017-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
*/
#ifndef CCE_CONFIGURATION_COMMAND_HH
#define CCE_CONFIGURATION_COMMAND_HH

Expand Down Expand Up @@ -58,8 +57,8 @@ class command : public object {
static std::unordered_map<std::string, setter_func> const _setters;
};

typedef std::shared_ptr<command> command_ptr;
typedef std::set<command> set_command;
using command_ptr = std::shared_ptr<command>;
using set_command = std::set<command>;
} // namespace configuration

} // namespace com::centreon::engine
Expand Down
1 change: 0 additions & 1 deletion engine/inc/com/centreon/engine/configuration/connector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef CCE_CONFIGURATION_CONNECTOR_HH
#define CCE_CONFIGURATION_CONNECTOR_HH

#include "com/centreon/engine/commands/connector.hh"
#include "com/centreon/engine/configuration/object.hh"

namespace com::centreon::engine {
Expand Down
47 changes: 23 additions & 24 deletions engine/inc/com/centreon/engine/configuration/contactgroup.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/**
* Copyright 2011-2013,2017 Centreon
* Copyright 2011-2013,2017-2024 Centreon
*
* This file is part of Centreon Engine.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/

#ifndef CCE_CONFIGURATION_CONTACTGROUP_HH
#define CCE_CONFIGURATION_CONTACTGROUP_HH

Expand All @@ -32,22 +31,22 @@ class contactgroup : public object {

contactgroup(key_type const& key = "");
contactgroup(contactgroup const& right);
~contactgroup() throw() override;
~contactgroup() noexcept override;
contactgroup& operator=(contactgroup const& right);
bool operator==(contactgroup const& right) const throw();
bool operator!=(contactgroup const& right) const throw();
bool operator<(contactgroup const& right) const throw();
bool operator==(contactgroup const& right) const noexcept;
bool operator!=(contactgroup const& right) const noexcept;
bool operator<(contactgroup const& right) const noexcept;
void check_validity() const override;
key_type const& key() const throw();
key_type const& key() const noexcept;
void merge(object const& obj) override;
bool parse(char const* key, char const* value) override;

std::string const& alias() const throw();
set_string& contactgroup_members() throw();
set_string const& contactgroup_members() const throw();
std::string const& contactgroup_name() const throw();
set_string& members() throw();
set_string const& members() const throw();
std::string const& alias() const noexcept;
set_string& contactgroup_members() noexcept;
set_string const& contactgroup_members() const noexcept;
std::string const& contactgroup_name() const noexcept;
set_string& members() noexcept;
set_string const& members() const noexcept;

private:
typedef bool (*setter_func)(contactgroup&, char const*);
Expand Down
40 changes: 20 additions & 20 deletions engine/inc/com/centreon/engine/configuration/file_info.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
** Copyright 2011-2013 Merethis
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2011-2013 Merethis
* Copyright 2014-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
*/
#ifndef CCE_CONFIGURATION_FILE_INFO_HH
#define CCE_CONFIGURATION_FILE_INFO_HH

Expand Down Expand Up @@ -59,6 +59,6 @@ class file_info {
};
} // namespace configuration

}
} // namespace com::centreon::engine

#endif // !CCE_CONFIGURATION_FILE_INFO_HH
70 changes: 33 additions & 37 deletions engine/inc/com/centreon/engine/configuration/group.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*
** Copyright 2011-2013,2017 Centreon
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2011-2013,2017-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
*/
#ifndef CCE_CONFIGURATION_GROUP_HH
#define CCE_CONFIGURATION_GROUP_HH

Expand All @@ -29,30 +28,29 @@ typedef std::list<std::string> list_string;
typedef std::set<std::string> set_string;
typedef std::set<std::pair<std::string, std::string> > set_pair_string;

namespace com::centreon::engine {
namespace com::centreon::engine::configuration {

namespace configuration {
template <typename T>
class group {
public:
group(bool inherit = false);
group(group const& other);
~group() throw();
~group() noexcept;
group& operator=(group const& other);
group& operator=(std::string const& other);
group& operator+=(group const& other);
bool operator==(group const& other) const throw();
bool operator!=(group const& other) const throw();
bool operator<(group const& other) const throw();
T& operator*() throw() { return (_data); }
T const& operator*() const throw() { return (_data); }
T* operator->() throw() { return (&_data); }
T const* operator->() const throw() { return (&_data); }
T& get() throw() { return (_data); }
T const& get() const throw() { return (_data); }
bool is_inherit() const throw() { return (_is_inherit); }
void is_inherit(bool enable) throw() { _is_inherit = enable; }
bool is_set() const throw() { return (_is_set); }
bool operator==(group const& other) const noexcept;
bool operator!=(group const& other) const noexcept;
bool operator<(group const& other) const noexcept;
T& operator*() noexcept { return (_data); }
T const& operator*() const noexcept { return (_data); }
T* operator->() noexcept { return (&_data); }
T const* operator->() const noexcept { return (&_data); }
T& get() noexcept { return (_data); }
T const& get() const noexcept { return (_data); }
bool is_inherit() const noexcept { return (_is_inherit); }
void is_inherit(bool enable) noexcept { _is_inherit = enable; }
bool is_set() const noexcept { return (_is_set); }
void reset();

private:
Expand All @@ -61,8 +59,6 @@ class group {
bool _is_null;
bool _is_set;
};
} // namespace configuration

}
} // namespace com::centreon::engine::configuration

#endif // !CCE_CONFIGURATION_GROUP_HH
39 changes: 19 additions & 20 deletions engine/inc/com/centreon/engine/configuration/hostdependency.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*
** Copyright 2011-2019 Centreon
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2011-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
*/
#ifndef CCE_CONFIGURATION_HOSTDEPENDENCY_HH
#define CCE_CONFIGURATION_HOSTDEPENDENCY_HH

Expand Down Expand Up @@ -102,6 +101,6 @@ typedef std::shared_ptr<hostdependency> hostdependency_ptr;
typedef std::set<hostdependency> set_hostdependency;
} // namespace configuration

}
} // namespace com::centreon::engine

#endif // !CCE_CONFIGURATION_HOSTDEPENDENCY_HH
39 changes: 19 additions & 20 deletions engine/inc/com/centreon/engine/configuration/hostescalation.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*
** Copyright 2011-2013,2017 Centreon
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2011-2013,2017-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
*/
#ifndef CCE_CONFIGURATION_HOSTESCALATION_HH
#define CCE_CONFIGURATION_HOSTESCALATION_HH

Expand Down Expand Up @@ -99,6 +98,6 @@ typedef std::shared_ptr<hostescalation> hostescalation_ptr;
typedef std::set<hostescalation> set_hostescalation;
} // namespace configuration

}
} // namespace com::centreon::engine

#endif // !CCE_CONFIGURATION_HOSTESCALATION_HH
Loading

0 comments on commit 063a994

Please sign in to comment.