Program Listing for File Feature.hpp

Return to documentation for file (include/nix/Feature.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_FEATURE_H
#define NIX_FEATURE_H

#include <nix/base/Entity.hpp>
#include <nix/base/IFeature.hpp>
#include <nix/DataArray.hpp>
#include <nix/ObjectType.hpp>

#include <nix/Platform.hpp>

namespace nix {


class NIXAPI Feature : public base::Entity<base::IFeature> {

public:

    Feature()
        : Entity()
    {
    }

    Feature(const Feature &other)
        : Entity(other.impl())
    {
    }

    Feature(const std::shared_ptr<base::IFeature> &p_impl)
        : Entity(p_impl)
    {
    }

    Feature(std::shared_ptr<base::IFeature> &&ptr)
        : Entity(std::move(ptr))
    {
    }

    void linkType(LinkType type) {
        backend()->linkType(type);
    }

    LinkType linkType() const {
        return backend()->linkType();
    }

    void data(const std::string &name_or_id);

    void data(const DataArray &data);

    DataArray data() const {
        return backend()->data();
    }

    virtual ~Feature() {}

    //--------------------------------------------------
    // Other methods and functions
    //--------------------------------------------------

    Feature &operator=(const none_t &t) {
        ImplContainer::operator=(t);
        return *this;
    }

    Feature &operator=(const Feature &other)  {
        ImplContainer::operator=(other);
        return *this;
    }
};

NIXAPI std::string link_type_to_string(LinkType ltype);

NIXAPI std::ostream& operator<<(std::ostream &out, const LinkType ltype);


template<>
struct objectToType<nix::Feature> {
    static const bool isValid = true;
    static const ObjectType value = ObjectType::Feature;
    typedef nix::base::IFeature backendType;
};

} // namespace nix

#endif // NIX_FEATURE_H