Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
centreon
centreon-collect
Commits
690a0961
Commit
690a0961
authored
Jun 08, 2020
by
David Boucher
Browse files
cleanup(hash_func): std::pair<str,str> has its own hash func
parent
345caf3c
Changes
12
Hide whitespace changes
Inline
Side-by-side
include/com/centreon/broker/graphite/macro_cache.hh
View file @
690a0961
...
...
@@ -23,8 +23,8 @@
#include
<memory>
#include
<string>
#include
<unordered_map>
#include
"com/centreon/broker/io/factory.hh"
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/broker/namespace.hh"
#include
"com/centreon/broker/neb/host.hh"
#include
"com/centreon/broker/neb/instance.hh"
...
...
@@ -32,6 +32,7 @@
#include
"com/centreon/broker/persistent_cache.hh"
#include
"com/centreon/broker/storage/index_mapping.hh"
#include
"com/centreon/broker/storage/metric_mapping.hh"
#include
"com/centreon/pair.hh"
CCB_BEGIN
()
...
...
@@ -46,7 +47,8 @@ class macro_cache {
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
neb
::
instance
>
>
_instances
;
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
neb
::
host
>
>
_hosts
;
std
::
unordered_map
<
std
::
pair
<
uint64_t
,
uint64_t
>
,
std
::
shared_ptr
<
neb
::
service
>
>
_services
;
std
::
shared_ptr
<
neb
::
service
>
>
_services
;
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
storage
::
index_mapping
>
>
_index_mappings
;
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
storage
::
metric_mapping
>
>
...
...
include/com/centreon/broker/influxdb/macro_cache.hh
View file @
690a0961
...
...
@@ -23,8 +23,8 @@
#include
<memory>
#include
<string>
#include
<unordered_map>
#include
"com/centreon/broker/io/factory.hh"
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/broker/namespace.hh"
#include
"com/centreon/broker/neb/host.hh"
#include
"com/centreon/broker/neb/instance.hh"
...
...
@@ -32,6 +32,7 @@
#include
"com/centreon/broker/persistent_cache.hh"
#include
"com/centreon/broker/storage/index_mapping.hh"
#include
"com/centreon/broker/storage/metric_mapping.hh"
#include
"com/centreon/pair.hh"
CCB_BEGIN
()
namespace
influxdb
{
...
...
@@ -45,7 +46,8 @@ class macro_cache {
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
neb
::
instance
>
>
_instances
;
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
neb
::
host
>
>
_hosts
;
std
::
unordered_map
<
std
::
pair
<
uint64_t
,
uint64_t
>
,
std
::
shared_ptr
<
neb
::
service
>
>
_services
;
std
::
shared_ptr
<
neb
::
service
>
>
_services
;
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
storage
::
index_mapping
>
>
_index_mappings
;
std
::
unordered_map
<
uint64_t
,
std
::
shared_ptr
<
storage
::
metric_mapping
>
>
...
...
include/com/centreon/broker/lua/macro_cache.hh
View file @
690a0961
...
...
@@ -27,7 +27,6 @@
#include
"com/centreon/broker/bam/dimension_ba_event.hh"
#include
"com/centreon/broker/bam/dimension_bv_event.hh"
#include
"com/centreon/broker/bam/dimension_truncate_table_signal.hh"
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/broker/neb/custom_variable.hh"
#include
"com/centreon/broker/neb/host.hh"
#include
"com/centreon/broker/neb/host_group.hh"
...
...
@@ -39,6 +38,7 @@
#include
"com/centreon/broker/persistent_cache.hh"
#include
"com/centreon/broker/storage/index_mapping.hh"
#include
"com/centreon/broker/storage/metric_mapping.hh"
#include
"com/centreon/pair.hh"
CCB_BEGIN
()
...
...
include/com/centreon/broker/neb/downtime_map.hh
View file @
690a0961
...
...
@@ -20,10 +20,11 @@
#define CCB_NEB_DOWNTIME_MAP_HH
#include
<unordered_map>
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/broker/namespace.hh"
#include
"com/centreon/broker/neb/downtime.hh"
#include
"com/centreon/broker/neb/node_id.hh"
#include
"com/centreon/pair.hh"
CCB_BEGIN
()
...
...
@@ -56,8 +57,7 @@ class downtime_map {
std
::
unordered_map
<
uint32_t
,
downtime
>
_downtimes
;
std
::
unordered_multimap
<
node_id
,
uint32_t
>
_downtime_id_by_nodes
;
std
::
unordered_map
<
uint32_t
,
downtime
>
_recurring_downtimes
;
std
::
unordered_multimap
<
node_id
,
uint32_t
>
_recurring_downtime_id_by_nodes
;
std
::
unordered_multimap
<
node_id
,
uint32_t
>
_recurring_downtime_id_by_nodes
;
};
}
// namespace neb
...
...
include/com/centreon/broker/neb/node_cache.hh
View file @
690a0961
...
...
@@ -22,8 +22,8 @@
#include
<memory>
#include
<string>
#include
<unordered_map>
#include
"com/centreon/broker/io/endpoint.hh"
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/broker/namespace.hh"
#include
"com/centreon/broker/neb/host.hh"
#include
"com/centreon/broker/neb/host_status.hh"
...
...
@@ -31,6 +31,7 @@
#include
"com/centreon/broker/neb/service.hh"
#include
"com/centreon/broker/neb/service_status.hh"
#include
"com/centreon/broker/persistent_cache.hh"
#include
"com/centreon/pair.hh"
CCB_BEGIN
()
...
...
include/com/centreon/broker/storage/conflict_manager.hh
View file @
690a0961
...
...
@@ -30,9 +30,9 @@
#include
"com/centreon/broker/io/events.hh"
#include
"com/centreon/broker/io/stream.hh"
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/broker/mysql.hh"
#include
"com/centreon/broker/storage/stored_timestamp.hh"
#include
"com/centreon/pair.hh"
CCB_BEGIN
()
/* Forward declarations */
...
...
include/com/centreon/engine/hash.hh
deleted
100644 → 0
View file @
345caf3c
#ifndef CCE_HASH_HH
#define CCE_HASH_HH
struct
pair_hash
{
template
<
class
T1
,
class
T2
>
std
::
size_t
operator
()(
const
std
::
pair
<
T1
,
T2
>&
pair
)
const
{
return
std
::
hash
<
T1
>
()(
pair
.
first
)
^
std
::
hash
<
T2
>
()(
pair
.
second
);
}
std
::
size_t
operator
()(
const
std
::
pair
<
std
::
string
,
std
::
string
>&
pair
)
const
{
size_t
hash
=
0
;
hash_combine
(
hash
,
pair
.
first
);
hash_combine
(
hash
,
pair
.
second
);
return
hash
;
}
inline
static
void
hash_combine
(
std
::
size_t
&
seed
,
const
std
::
string
&
v
)
{
std
::
hash
<
std
::
string
>
hasher
;
seed
^=
hasher
(
v
)
+
0x9e3779b9
+
(
seed
<<
6
)
+
(
seed
>>
2
);
}
};
#endif
include/com/centreon/engine/service.hh
View file @
690a0961
...
...
@@ -32,9 +32,9 @@
#include
"com/centreon/engine/check_result.hh"
#include
"com/centreon/engine/common.hh"
#include
"com/centreon/engine/customvariable.hh"
#include
"com/centreon/broker/misc/pair.hh"
#include
"com/centreon/engine/logging.hh"
#include
"com/centreon/engine/notifier.hh"
#include
"com/centreon/pair.hh"
/* Forward declaration. */
CCE_BEGIN
()
...
...
@@ -49,16 +49,13 @@ class serviceescalation;
CCE_END
()
typedef
std
::
unordered_map
<
std
::
pair
<
std
::
string
,
std
::
string
>
,
std
::
shared_ptr
<
com
::
centreon
::
engine
::
service
>
>
std
::
shared_ptr
<
com
::
centreon
::
engine
::
service
>
>
service_map
;
typedef
std
::
unordered_map
<
std
::
pair
<
std
::
string
,
std
::
string
>
,
com
::
centreon
::
engine
::
service
*
>
com
::
centreon
::
engine
::
service
*>
service_map_unsafe
;
typedef
std
::
unordered_map
<
std
::
pair
<
uint64_t
,
uint64_t
>
,
std
::
shared_ptr
<
com
::
centreon
::
engine
::
service
>
>
std
::
shared_ptr
<
com
::
centreon
::
engine
::
service
>
>
service_id_map
;
CCE_BEGIN
()
...
...
include/com/centreon/engine/servicedependency.hh
View file @
690a0961
...
...
@@ -21,8 +21,8 @@
#define CCE_OBJECTS_SERVICEDEPENDENCY_HH
#include
"com/centreon/engine/configuration/servicedependency.hh"
#include
"com/centreon/engine/dependency.hh"
#include
"com/centreon/engine/hash.hh"
#include
"com/centreon/engine/namespace.hh"
#include
"com/centreon/pair.hh"
/* Forward declaration. */
CCE_BEGIN
()
...
...
@@ -33,8 +33,7 @@ CCE_END()
typedef
std
::
unordered_multimap
<
std
::
pair
<
std
::
string
,
std
::
string
>
,
std
::
shared_ptr
<
com
::
centreon
::
engine
::
servicedependency
>
,
pair_hash
>
std
::
shared_ptr
<
com
::
centreon
::
engine
::
servicedependency
>>
servicedependency_mmap
;
CCE_BEGIN
()
...
...
include/com/centreon/engine/serviceescalation.hh
View file @
690a0961
...
...
@@ -21,7 +21,7 @@
#define CCE_SERVICEESCALATION_HH
#include
"com/centreon/engine/escalation.hh"
#include
"com/centreon/
engine/hash
.hh"
#include
"com/centreon/
pair
.hh"
/* Forward declaration. */
CCE_BEGIN
()
...
...
@@ -30,8 +30,7 @@ CCE_END()
typedef
std
::
unordered_multimap
<
std
::
pair
<
std
::
string
,
std
::
string
>
,
std
::
shared_ptr
<
com
::
centreon
::
engine
::
serviceescalation
>
,
pair_hash
>
std
::
shared_ptr
<
com
::
centreon
::
engine
::
serviceescalation
>>
serviceescalation_mmap
;
CCE_BEGIN
()
...
...
include/com/centreon/
broker/misc/
pair.hh
→
include/com/centreon/pair.hh
View file @
690a0961
...
...
@@ -16,8 +16,8 @@
** For more information : contact@centreon.com
*/
#ifndef
CCB_NEB_
STRING_PAIR_HH
#define
CCB_NEB_
STRING_PAIR_HH
#ifndef STRING_PAIR_HH
#define STRING_PAIR_HH
#include
<functional>
...
...
@@ -85,4 +85,4 @@ struct hash<std::pair<uint32_t, std::string>> {
}
// namespace std
#endif
/*
CCB_NEB_
STRING_PAIR_HH */
#endif
/* STRING_PAIR_HH */
src/70-lua/broker_cache.cc
View file @
690a0961
...
...
@@ -18,7 +18,7 @@
#include
"com/centreon/broker/lua/broker_cache.hh"
#include
"com/centreon/
broker/misc/
pair.hh"
#include
"com/centreon/pair.hh"
using
namespace
com
::
centreon
::
broker
;
using
namespace
com
::
centreon
::
broker
::
lua
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment