MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/systemic/ObjectAddress.hh
2024-06-07 11:12:56 +03:00

40 lines
921 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* ObjectAddress.hh
*
* Created on: 15 апр. 2022 г.
* Author: titov
*/
#ifndef UMLIBRARY_SCHEMATIC_OBJECTADDRESS_HH_
#define UMLIBRARY_SCHEMATIC_OBJECTADDRESS_HH_
#include <typeinfo>
namespace systemic {
//!Интерфейс передачи адреса POD данных.
struct Addressable {
virtual const void * address() const = 0;
virtual std::size_t size() const = 0;
virtual std::size_t type_hash() const = 0;
};
//!Класс доступа адреса объекта.
template<typename Object>
class ObjectAddress : public Addressable {
const Object * object = nullptr;
public:
ObjectAddress( const Object * object ) : object(object) {}
const void * address() const { return object; }
std::size_t size() const { return sizeof(Object); }
std::size_t type_hash() const { return sizeof(Object); }
};
}
#endif /* UMLIBRARY_SCHEMATIC_OBJECTADDRESS_HH_ */