Program Listing for File GenericMemoryVector.h

Return to documentation for file (include/flamegpu/simulation/detail/GenericMemoryVector.h)

#ifndef INCLUDE_FLAMEGPU_SIMULATION_DETAIL_GENERICMEMORYVECTOR_H_
#define INCLUDE_FLAMEGPU_SIMULATION_DETAIL_GENERICMEMORYVECTOR_H_

#include <vector>
#include <typeindex>
#include <map>
#include <memory>
#include <utility>
#include <string>

#include "flamegpu/exception/FLAMEGPUException.h"

namespace flamegpu {
namespace detail {

class GenericMemoryVector{
 public:
    virtual ~GenericMemoryVector() { }
    virtual const std::type_index& getType() const = 0;
    virtual unsigned int getElements() const = 0;
    virtual size_t getTypeSize() const = 0;
    virtual size_t getVariableSize() const = 0;
    virtual void* getDataPtr() = 0;
    virtual const void* getReadOnlyDataPtr() const = 0;
    virtual GenericMemoryVector* clone() const = 0;
    virtual void resize(unsigned int t) = 0;
};

// use this to store default values for a population, must be here to register the correct types at compile time
typedef std::map<const std::string, std::unique_ptr<GenericMemoryVector>> StateMemoryMap;

typedef std::pair<const std::string, std::unique_ptr<GenericMemoryVector>> StateMemoryMapPair;

}  // namespace detail
}  // namespace flamegpu

#endif  // INCLUDE_FLAMEGPU_SIMULATION_DETAIL_GENERICMEMORYVECTOR_H_