Skip to content
Snippets Groups Projects
SpecializedSegment.h 1.7 KiB
Newer Older
#pragma once

#include <mutex>
#include <string>

#include <ArmarXCore/core/application/properties/forward_declarations.h>
#include <ArmarXCore/core/logging/Logging.h>


namespace armarx::aron::typenavigator
{
    using ObjectNavigatorPtr = std::shared_ptr<class ObjectNavigator>;
}
namespace armarx::armem
{
    namespace server
    {
        class MemoryToIceAdapter;
    }

    namespace wm
    {
        class CoreSegment;
    }
}

namespace armarx::armem::server::segment
{

    /**
     * @brief Specialized management of a core segment.
     */
    class SpecializedSegment :
            public armarx::Logging
    {
    public:

        SpecializedSegment(
                server::MemoryToIceAdapter& iceMemory,
                aron::typenavigator::ObjectNavigatorPtr aronType = nullptr,
                const std::string& defaultCoreSegmentName = "",
                int64_t defaultMaxHistorySize = -1);

        virtual ~SpecializedSegment();


        virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string& prefix = "");
        virtual void init();
        // void connect();

        std::mutex& mutex() const;


    protected:

        void setDefaultCoreSegmentName(const std::string& coreSegmentName);
        void setDefaultMaxHistorySize(int64_t maxHistorySize);
        void setAronType(aron::typenavigator::ObjectNavigatorPtr aronType);


    protected:

        server::MemoryToIceAdapter& iceMemory;
        wm::CoreSegment* coreSegment = nullptr;
        aron::typenavigator::ObjectNavigatorPtr aronType;

        struct Properties
        {
            std::string coreSegmentName = "";
            int64_t maxHistorySize = -1;
        };
        Properties properties;


    };

}