Ophidian
 All Classes Namespaces Functions
sites.h
1 /*
2  * Copyright 2016 Ophidian
3 Licensed to the Apache Software Foundation (ASF) under one
4 or more contributor license agreements. See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership. The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License. You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0
12 
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations
18 under the License.
19  */
20 
21 #ifndef ophidian_SITES_H
22 #define ophidian_SITES_H
23 
24 #include <vector_property.h>
25 #include <entity_system.h>
26 #include "../geometry/geometry.h"
27 
28 namespace ophidian {
29  namespace floorplan {
31 
34  class sites {
35  using point = geometry::point<double>;
36 
38 
41 
42  public:
44 
49 
51 
56  std::string name(entity_system::entity site) const {
57  return m_names[m_system.lookup(site)];
58  }
59 
61 
66  point dimensions(entity_system::entity site) const {
67  return m_dimensions[m_system.lookup(site)];
68  }
69 
71 
75  std::pair< std::vector<std::string>::const_iterator, std::vector<std::string>::const_iterator > names() const {
76  return std::make_pair(m_names.begin(), m_names.end());
77  }
78 
80 
84  std::pair< std::vector<point>::const_iterator, std::vector<point>::const_iterator > dimensions() const {
85  return std::make_pair(m_dimensions.begin(), m_dimensions.end());
86  }
87 
89 
94  void name(entity_system::entity site, std::string name);
96 
101  void dimensions(entity_system::entity site, point dimensions);
102  };
103  }
104 }
105 
106 
107 
108 #endif //ophidian_SITES_H
point dimensions(entity_system::entity site) const
Dimensions getter.
Definition: sites.h:66
std::pair< std::vector< std::string >::const_iterator, std::vector< std::string >::const_iterator > names() const
Name iterator getter.
Definition: sites.h:75
sites(entity_system::entity_system &system)
Constructor.
Definition: sites.cpp:26
std::vector< T >::const_iterator begin() const
Begin iterator.
Definition: vector_property.h:137
std::string name(entity_system::entity site) const
Name getter.
Definition: sites.h:56
std::vector< T >::const_iterator end() const
End iterator.
Definition: vector_property.h:146
Sites class.
Definition: sites.h:34
std::pair< std::vector< point >::const_iterator, std::vector< point >::const_iterator > dimensions() const
Dimensions iterator getter.
Definition: sites.h:84
entity_system class.
Definition: entity_system.h:40
entity_index lookup(entity e) const
Gets the index of an entity.
Definition: entity_system.h:149