Program Listing for File Property.hpp¶
↰ Return to documentation for file (include/nix/Property.hpp)
// Copyright (c) 2013, German Neuroinformatics Node (G-Node)
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted under the terms of the BSD License. See
// LICENSE file in the root of the Project.
#ifndef NIX_PROPERTY_H
#define NIX_PROPERTY_H
#include <nix/base/Entity.hpp>
#include <nix/base/IProperty.hpp>
#include <nix/Variant.hpp>
#include <nix/ObjectType.hpp>
#include <nix/Platform.hpp>
#include <ostream>
#include <memory>
namespace nix {
class NIXAPI Property : public base::Entity<base::IProperty> {
public:
Property()
: Entity()
{
}
Property(const Property &other)
: Entity(other.impl())
{
}
Property(const std::shared_ptr<base::IProperty> &p_impl)
: Entity(p_impl)
{
}
Property(std::shared_ptr<base::IProperty> &&ptr)
: Entity(std::move(ptr))
{
}
//--------------------------------------------------
// Attribute getter and setter
//--------------------------------------------------
std::string name() const {
return backend()->name();
}
void definition(const std::string &definition);
boost::optional<std::string> definition() const {
return backend()->definition();
}
void definition(const none_t t) {
backend()->definition(t);
}
DataType dataType() const {
return backend()->dataType();
}
void uncertainty(double uncertainty) {
backend()->uncertainty(uncertainty);
}
boost::optional<double> uncertainty() const {
return backend()->uncertainty();
}
void uncertainty(const boost::none_t t) {
return backend()->uncertainty(t);
}
void unit(const std::string &unit);
boost::optional<std::string> unit() const {
return backend()->unit();
}
void unit(const boost::none_t t) {
return backend()->unit(t);
}
//--------------------------------------------------
// Methods for Value access
//--------------------------------------------------
void deleteValues() {
backend()->deleteValues();
}
ndsize_t valueCount() const {
return backend()->valueCount();
}
void values(const std::vector<Variant> &values) {
backend()->values(values);
}
std::vector<Variant> values(void) const {
return backend()->values();
}
void values(const boost::none_t t) {
backend()->values(t);
}
//------------------------------------------------------
// Operators and other functions
//------------------------------------------------------
int compare(const Property &other) const;
Property &operator=(const none_t &t) {
ImplContainer::operator=(t);
return *this;
}
Property &operator=(const Property &other) {
ImplContainer::operator=(other);
return *this;
}
NIXAPI friend std::ostream& operator<<(std::ostream &out, const Property &ent);
virtual ~Property() {}
};
template<>
struct objectToType<nix::Property> {
static const bool isValid = true;
static const ObjectType value = ObjectType::Property;
typedef nix::base::IProperty backendType;
};
} // namespace nix
#endif // NIX_PROPERTY_H