diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-02-09 00:02:00 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-02-09 20:37:04 -0500 |
commit | 12f8a3c8d0725cde677fb183454f2075df54f31e (patch) | |
tree | 21f08f8117128ea862a284b87e9a5bc065dd2814 | |
parent | 150147aed2951ba0b5c925b2c4f023c5e01f7272 (diff) | |
download | phosphor-inventory-manager-12f8a3c8d0725cde677fb183454f2075df54f31e.tar.gz phosphor-inventory-manager-12f8a3c8d0725cde677fb183454f2075df54f31e.zip |
Remove details namespace
The usage was incoherent and it isn't really necessary for
application only objects.
Change-Id: I76eb5525a39fbbef95548558e777940edf574a06
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r-- | actions.hpp | 4 | ||||
-rw-r--r-- | events.cpp | 3 | ||||
-rw-r--r-- | events.hpp | 10 | ||||
-rw-r--r-- | generated.mako.cpp | 4 | ||||
-rw-r--r-- | manager.cpp | 23 | ||||
-rw-r--r-- | manager.hpp | 15 | ||||
-rwxr-xr-x | pimgen.py | 14 |
7 files changed, 27 insertions, 46 deletions
diff --git a/actions.hpp b/actions.hpp index 403dca1..5b13a46 100644 --- a/actions.hpp +++ b/actions.hpp @@ -14,8 +14,7 @@ namespace manager { class Manager; -namespace details -{ + using Action = std::function<void (sdbusplus::bus::bus&, Manager&)>; /** @brief make_action @@ -32,7 +31,6 @@ auto make_action(T&& action) { return Action(std::forward<T>(action)); } -} // namespace details namespace actions { @@ -24,8 +24,6 @@ namespace manager { namespace filters { -namespace details -{ namespace property_condition { @@ -90,7 +88,6 @@ bool PropertyConditionBase::operator()( } } // namespace property_condition -} // namespace details } // namespace filters } // namespace manager } // namespace inventory @@ -14,8 +14,6 @@ namespace manager { class Manager; -namespace details -{ using Filter = std::function < bool (sdbusplus::bus::bus&, sdbusplus::message::message&, Manager&) >; @@ -98,12 +96,9 @@ auto make_filter(T&& filter) { return Filter(std::forward<T>(filter)); } -} // namespace details namespace filters { -namespace details -{ namespace property_condition { @@ -281,7 +276,6 @@ struct PropertyCondition final : public PropertyConditionBase }; } // namespace property_condition -} // namespace details /** @brief Implicit type deduction for constructing PropertyChangedCondition. */ template <typename T> @@ -295,7 +289,7 @@ auto propertyChangedTo( return arg == val; }; using U = decltype(condition); - return details::property_condition::PropertyChangedCondition<T, U>( + return property_condition::PropertyChangedCondition<T, U>( iface, property, std::move(condition)); } @@ -313,7 +307,7 @@ auto propertyIs( return arg == val; }; using U = decltype(condition); - return details::property_condition::PropertyCondition<T, U>( + return property_condition::PropertyCondition<T, U>( path, iface, property, std::move(condition), service); } diff --git a/generated.mako.cpp b/generated.mako.cpp index 562465d..fe2c6cb 100644 --- a/generated.mako.cpp +++ b/generated.mako.cpp @@ -21,8 +21,8 @@ const Manager::Makers Manager::_makers{ { "${str(i)}", std::make_tuple( - details::MakeInterface< - details::ServerObject< + MakeInterface< + ServerObject< ${i.namespace()}>>::make ) }, diff --git a/manager.cpp b/manager.cpp index 83923d9..1d1f778 100644 --- a/manager.cpp +++ b/manager.cpp @@ -26,9 +26,6 @@ namespace inventory { namespace manager { -namespace details -{ - /** @brief Fowrarding signal callback. * * Extracts per-signal specific context and forwards the call to the manager @@ -44,7 +41,7 @@ auto _signal(sd_bus_message* m, void* data, sd_bus_error* e) noexcept auto& mgr = *std::get<0>(args); mgr.handleEvent( msg, - static_cast<const details::DbusSignal&>( + static_cast<const DbusSignal&>( *std::get<1>(args)), *std::get<2>(args)); } @@ -56,14 +53,12 @@ auto _signal(sd_bus_message* m, void* data, sd_bus_error* e) noexcept return 0; } -} // namespace details - Manager::Manager( sdbusplus::bus::bus&& bus, const char* busname, const char* root, const char* iface) : - details::ServerObject<details::ManagerIface>(bus, root), + ServerObject<ManagerIface>(bus, root), _shutdown(false), _root(root), _bus(std::move(bus)), @@ -71,17 +66,17 @@ Manager::Manager( { for (auto& group : _events) { - for (auto pEvent : std::get<std::vector<details::EventBasePtr>>( + for (auto pEvent : std::get<std::vector<EventBasePtr>>( group)) { if (pEvent->type != - details::Event::Type::DBUS_SIGNAL) + Event::Type::DBUS_SIGNAL) { continue; } // Create a callback context for this event group. - auto dbusEvent = static_cast<details::DbusSignal*>( + auto dbusEvent = static_cast<DbusSignal*>( pEvent.get()); // Go ahead and store an iterator pointing at @@ -99,7 +94,7 @@ Manager::Manager( _matches.emplace_back( _bus, dbusEvent->signature, - details::_signal, + _signal, _sigargs.back().get()); } } @@ -119,11 +114,11 @@ void Manager::run() noexcept // Run startup events. for (auto& group : _events) { - for (auto pEvent : std::get<std::vector<details::EventBasePtr>>( + for (auto pEvent : std::get<std::vector<EventBasePtr>>( group)) { if (pEvent->type == - details::Event::Type::STARTUP) + Event::Type::STARTUP) { handleEvent(unusedMsg, *pEvent, group); } @@ -158,7 +153,7 @@ void Manager::notify(std::map<sdbusplus::message::object_path, Object> objs) void Manager::handleEvent( sdbusplus::message::message& msg, - const details::Event& event, + const Event& event, const EventInfo& info) { auto& actions = std::get<1>(info); diff --git a/manager.hpp b/manager.hpp index 7127ec5..5e0930b 100644 --- a/manager.hpp +++ b/manager.hpp @@ -16,8 +16,6 @@ namespace inventory { namespace manager { -namespace details -{ template <typename T> using ServerObject = T; @@ -45,7 +43,6 @@ struct MakeInterface return any_ns::any(std::make_shared<T>(bus, path)); } }; -} // namespace details /** @class Manager * @brief OpenBMC inventory manager implementation. @@ -54,7 +51,7 @@ struct MakeInterface * DBus API. */ class Manager final : - public details::ServerObject<details::ManagerIface> + public ServerObject<ManagerIface> { public: Manager() = delete; @@ -75,8 +72,8 @@ class Manager final : Manager(sdbusplus::bus::bus&&, const char*, const char*, const char*); using EventInfo = std::tuple < - std::vector<details::EventBasePtr>, - std::vector<details::Action >>; + std::vector<EventBasePtr>, + std::vector<Action >>; /** @brief Start processing DBus messages. */ void run() noexcept; @@ -90,7 +87,7 @@ class Manager final : /** @brief Event processing entry point. */ void handleEvent(sdbusplus::message::message&, - const details::Event& event, + const Event& event, const EventInfo& info); /** @brief Drop one or more objects from DBus. */ @@ -131,7 +128,7 @@ class Manager final : std::unique_ptr < std::tuple < Manager*, - const details::DbusSignal*, + const DbusSignal*, const EventInfo* >>>; using SigArg = SigArgs::value_type::element_type; @@ -143,7 +140,7 @@ class Manager final : // The int instantiation is safe since the signature of these // functions don't change from one instantiation to the next. using MakerType = std::add_pointer_t < - decltype(details::MakeInterface<int>::make) >; + decltype(MakeInterface<int>::make) >; using Makers = std::map<std::string, std::tuple<MakerType>>; /** @brief Provides weak references to interface holders. @@ -227,7 +227,7 @@ class Filter(Wrapper): def __init__(self, **kw): kw['wrapper_name'] = 'make_filter' - kw['wrapper_namespace'] = ['details'] + kw['wrapper_namespace'] = [] kw['namespace'] = ['filters'] super(Filter, self).__init__(**kw) @@ -237,7 +237,7 @@ class Action(Wrapper): def __init__(self, **kw): kw['wrapper_name'] = 'make_action' - kw['wrapper_namespace'] = ['details'] + kw['wrapper_namespace'] = [] kw['namespace'] = ['actions'] super(Action, self).__init__(**kw) @@ -371,7 +371,7 @@ class Event(MethodCall): filters = [ self.filter_map[x['name']](**x) for x in kw.pop('filters', [])] filters = Vector( - templates=[Template(name='Filter', namespace=['details'])], + templates=[Template(name='Filter', namespace=[])], args=filters) event = MethodCall( @@ -383,10 +383,10 @@ class Event(MethodCall): args=kw.pop('event_args', []) + [filters]) events = Vector( - templates=[Template(name='EventBasePtr', namespace=['details'])], + templates=[Template(name='EventBasePtr', namespace=[])], args=[event]) - action_type = Template(name='Action', namespace=['details']) + action_type = Template(name='Action', namespace=[]) action_args = [ self.action_map[x['name']](**x) for x in kw.pop('actions', [])] actions = Vector( @@ -405,7 +405,7 @@ class MatchEvent(Event): def __init__(self, **kw): kw['event'] = 'DbusSignal' - kw['event_namespace'] = ['details'] + kw['event_namespace'] = [] kw['event_args'] = [ DbusSignature(**x) for x in kw.pop('signatures', [])] @@ -417,7 +417,7 @@ class StartupEvent(Event): def __init__(self, **kw): kw['event'] = 'StartupEvent' - kw['event_namespace'] = ['details'] + kw['event_namespace'] = [] super(StartupEvent, self).__init__(**kw) |