registrator.h 620 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include <util/generic/fwd.h>
  3. #define REGISTER_RE_LIB(...) \
  4. namespace { \
  5. struct TReWrapperStaticRegistrator { \
  6. inline TReWrapperStaticRegistrator() { \
  7. NRegistrator::AddLibrary(__VA_ARGS__); \
  8. } \
  9. } RE_REGISTRATOR; \
  10. }
  11. namespace NReWrapper {
  12. class IRe;
  13. class TSerialization;
  14. using IRePtr = std::unique_ptr<IRe>;
  15. namespace NRegistrator {
  16. using TCompiler = IRePtr(*)(const TStringBuf&, unsigned int);
  17. using TDeserializer = IRePtr(*)(const TSerialization&);
  18. void AddLibrary(ui32 id, TCompiler compiler, TDeserializer deserializer);
  19. }
  20. }