[seiscomp, scanloc] Install, add .gitignore
This commit is contained in:
186
include/seiscomp/datamodel/parameter.h
Normal file
186
include/seiscomp/datamodel/parameter.h
Normal file
@ -0,0 +1,186 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_DATAMODEL_PARAMETER_H
|
||||
#define SEISCOMP_DATAMODEL_PARAMETER_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <seiscomp/datamodel/comment.h>
|
||||
#include <seiscomp/datamodel/notifier.h>
|
||||
#include <seiscomp/datamodel/publicobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace DataModel {
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Parameter);
|
||||
DEFINE_SMARTPOINTER(Comment);
|
||||
|
||||
class ParameterSet;
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API Parameter : public PublicObject {
|
||||
DECLARE_SC_CLASS(Parameter)
|
||||
DECLARE_SERIALIZATION;
|
||||
DECLARE_METAOBJECT;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Xstruction
|
||||
// ------------------------------------------------------------------
|
||||
protected:
|
||||
//! Protected constructor
|
||||
Parameter();
|
||||
|
||||
public:
|
||||
//! Copy constructor
|
||||
Parameter(const Parameter& other);
|
||||
|
||||
//! Constructor with publicID
|
||||
Parameter(const std::string& publicID);
|
||||
|
||||
//! Destructor
|
||||
~Parameter() override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Creators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Parameter* Create();
|
||||
static Parameter* Create(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Lookup
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
static Parameter* Find(const std::string& publicID);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Operators
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
//! Copies the metadata of other to this
|
||||
//! No changes regarding child objects are made
|
||||
Parameter& operator=(const Parameter& other);
|
||||
//! Checks for equality of two objects. Child objects
|
||||
//! are not part of the check.
|
||||
bool operator==(const Parameter& other) const;
|
||||
bool operator!=(const Parameter& other) const;
|
||||
|
||||
//! Wrapper that calls operator==
|
||||
bool equal(const Parameter& other) const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Setters/Getters
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
void setName(const std::string& name);
|
||||
const std::string& name() const;
|
||||
|
||||
void setValue(const std::string& value);
|
||||
const std::string& value() const;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Public interface
|
||||
// ------------------------------------------------------------------
|
||||
public:
|
||||
/**
|
||||
* Add an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been added
|
||||
* @return false The object has not been added
|
||||
* because it already exists in the list
|
||||
* or it already has another parent
|
||||
*/
|
||||
bool add(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object.
|
||||
* @param obj The object pointer
|
||||
* @return true The object has been removed
|
||||
* @return false The object has not been removed
|
||||
* because it does not exist in the list
|
||||
*/
|
||||
bool remove(Comment* obj);
|
||||
|
||||
/**
|
||||
* Removes an object of a particular class.
|
||||
* @param i The object index
|
||||
* @return true The object has been removed
|
||||
* @return false The index is out of bounds
|
||||
*/
|
||||
bool removeComment(size_t i);
|
||||
bool removeComment(const CommentIndex& i);
|
||||
|
||||
//! Retrieve the number of objects of a particular class
|
||||
size_t commentCount() const;
|
||||
|
||||
//! Index access
|
||||
//! @return The object at index i
|
||||
Comment* comment(size_t i) const;
|
||||
Comment* comment(const CommentIndex& i) const;
|
||||
|
||||
//! Find an object by its unique attribute(s)
|
||||
|
||||
ParameterSet* parameterSet() const;
|
||||
|
||||
//! Implement Object interface
|
||||
bool assign(Object *other) override;
|
||||
bool attachTo(PublicObject *parent) override;
|
||||
bool detachFrom(PublicObject *parent) override;
|
||||
bool detach() override;
|
||||
|
||||
//! Creates a clone
|
||||
Object *clone() const override;
|
||||
|
||||
//! Implement PublicObject interface
|
||||
bool updateChild(Object *child) override;
|
||||
|
||||
void accept(Visitor *visitor) override;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------
|
||||
private:
|
||||
// Attributes
|
||||
std::string _name;
|
||||
std::string _value;
|
||||
|
||||
// Aggregations
|
||||
std::vector<CommentPtr> _comments;
|
||||
|
||||
DECLARE_SC_CLASSFACTORY_FRIEND(Parameter);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user