Node.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * @file Node.cpp
  3. * @author The PARADEVS Development Team
  4. * See the AUTHORS or Authors.txt file
  5. */
  6. /*
  7. * PARADEVS - the multimodeling and simulation environment
  8. * This file is a part of the PARADEVS environment
  9. *
  10. * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. #include <devs/Node.hpp>
  26. namespace paradevs {
  27. Node::Node(const std::string& port_name, Model* model)
  28. : _port_name(port_name), _model(model)
  29. { }
  30. Node::Node(const Node& other)
  31. : _port_name(other._port_name), _model(other._model)
  32. { }
  33. Node::~Node()
  34. { }
  35. bool Node::operator<(const Node& o) const
  36. {
  37. if (o._model == _model) {
  38. return o._port_name < _port_name;
  39. } else {
  40. return o._model < _model;
  41. }
  42. }
  43. bool Node::operator==(const Node& o) const
  44. {
  45. return (o._port_name == _port_name and o._model == _model);
  46. }
  47. const std::string& Node::get_port_name() const
  48. { return _port_name; }
  49. Model* Node::get_model() const
  50. { return _model; }
  51. } // namespace paradevs