common.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* common.h - Node-related forward declarations and typedefs
  2. * Copyright (C) 2017 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef CORE_NODE_COMMON_H_DF61A21D_A0D3_524F_9B48_0558874F8AD5
  18. #define CORE_NODE_COMMON_H_DF61A21D_A0D3_524F_9B48_0558874F8AD5
  19. #include <stdexcept>
  20. #include <core/std/type.h>
  21. #include <core/std/memory.h>
  22. #include <core/std/optional.h>
  23. #include <core/std/string.h>
  24. namespace rainynite::core {
  25. // forward declarations
  26. class AbstractValue;
  27. template <typename T>
  28. class BaseValue;
  29. // type aliases
  30. using Type = std::type_index;
  31. using AbstractReference = shared_ptr<AbstractValue>;
  32. // exceptions
  33. class NodeAccessError : public std::runtime_error {
  34. public:
  35. NodeAccessError(string const& msg) :
  36. std::runtime_error(msg)
  37. {}
  38. };
  39. } // namespace rainynite::core
  40. #endif