component_type.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2020 by
  4. * The Salk Institute for Biological Studies
  5. *
  6. * Use of this source code is governed by an MIT-style
  7. * license that can be found in the LICENSE file or at
  8. * https://opensource.org/licenses/MIT.
  9. *
  10. ******************************************************************************/
  11. #ifndef API_COMPONENT_TYPE_H
  12. #define API_COMPONENT_TYPE_H
  13. #include "generated/gen_component_type.h"
  14. #include "api/api_common.h"
  15. #include "api/component.h"
  16. namespace MCell {
  17. namespace API {
  18. class ComponentType: public GenComponentType, public std::enable_shared_from_this<ComponentType> {
  19. public:
  20. COMPONENT_TYPE_CTOR()
  21. std::shared_ptr<Component> inst(const std::string& state, const int bond) override {
  22. return std::make_shared<Component>(shared_from_this(), state, bond);
  23. }
  24. std::shared_ptr<Component> inst(const int state, const int bond) override {
  25. return std::make_shared<Component>(shared_from_this(), std::to_string(state), bond);
  26. }
  27. bool __eq__(const ComponentType& other) const override;
  28. std::string to_bngl_str() const override;
  29. // added manually
  30. std::string get_canonical_name() const;
  31. // needed when defining a set of ComponentTypes
  32. bool operator < (const ComponentType& other) const;
  33. };
  34. } // namespace API
  35. } // namespace MCell
  36. #endif // API_COMPONENT_TYPE_H