/usr/include/simgear/props/PropertyBasedMgr.hxx is in libsimgear-dev 1:2018.1.1+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | // Base class for property controlled subsystems
//
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#ifndef SG_PROPERTY_BASED_MGR_HXX_
#define SG_PROPERTY_BASED_MGR_HXX_
#include "PropertyBasedElement.hxx"
#include <simgear/structure/subsystem_mgr.hxx>
#include <boost/function.hpp>
#include <vector>
namespace simgear
{
class PropertyBasedMgr:
public SGSubsystem,
public SGPropertyChangeListener
{
public:
virtual void init();
virtual void shutdown();
virtual void update (double delta_time_sec);
/**
* Create a new PropertyBasedElement
*
* @param name Name of the new element
*/
PropertyBasedElementPtr createElement(const std::string& name = "");
/**
* Get an existing PropertyBasedElement by its index
*
* @param index Index of element node in property tree
*/
PropertyBasedElementPtr getElement(size_t index) const;
/**
* Get an existing PropertyBasedElement by its name
*
* @param name Name (value of child node "name" will be matched)
*/
PropertyBasedElementPtr getElement(const std::string& name) const;
virtual const SGPropertyNode* getPropertyRoot() const;
protected:
typedef boost::function<PropertyBasedElementPtr(SGPropertyNode*)>
ElementFactory;
/** Branch in the property tree for this property managed subsystem */
SGPropertyNode_ptr _props;
/** Property name of managed elements */
const std::string _name_elements;
/** The actually managed elements */
std::vector<PropertyBasedElementPtr> _elements;
/** Function object which creates a new element */
ElementFactory _element_factory;
/**
* @param props Root node of property branch used for controlling
* this subsystem
* @param name_elements The name of the nodes for the managed elements
*/
PropertyBasedMgr( SGPropertyNode_ptr props,
const std::string& name_elements,
ElementFactory element_factory );
virtual ~PropertyBasedMgr() = 0;
virtual void childAdded( SGPropertyNode * parent,
SGPropertyNode * child );
virtual void childRemoved( SGPropertyNode * parent,
SGPropertyNode * child );
virtual void elementCreated(PropertyBasedElementPtr element) {}
};
} // namespace simgear
#endif /* SG_PROPERTY_BASED_MGR_HXX_ */
|