Ophidian
 All Classes Namespaces Functions
rows.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_ROWS_H
22 #define ophidian_ROWS_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 rows {
35  using point = geometry::point<double>;
36 
38 
42 
43  public:
45 
50 
52 
57  entity_system::entity site(entity_system::entity row) const {
58  return m_sites[m_system.lookup(row)];
59  }
61 
66  unsigned number_of_sites(entity_system::entity row) const {
67  return m_number_of_sites[m_system.lookup(row)];
68  }
70 
75  point origin(entity_system::entity row) const {
76  return m_origins[m_system.lookup(row)];
77  }
78 
80 
84  std::pair< std::vector<entity_system::entity>::const_iterator, std::vector<entity_system::entity>::const_iterator > sites() const {
85  return std::make_pair(m_sites.begin(), m_sites.end());
86  }
88 
92  std::pair< std::vector<unsigned>::const_iterator, std::vector<unsigned>::const_iterator > number_of_sites() const {
93  return std::make_pair(m_number_of_sites.begin(), m_number_of_sites.end());
94  }
96 
100  std::pair< std::vector<point>::const_iterator, std::vector<point>::const_iterator > origins() const {
101  return std::make_pair(m_origins.begin(), m_origins.end());
102  }
103 
105 
110  void site(entity_system::entity row, entity_system::entity site);
112 
117  void number_of_sites(entity_system::entity row, unsigned number_of_sites);
119 
124  void origin(entity_system::entity row, point origin);
125  };
126  }
127 }
128 
129 
130 #endif //ophidian_ROWS_H
unsigned number_of_sites(entity_system::entity row) const
Number of sites getter.
Definition: rows.h:66
std::vector< T >::const_iterator begin() const
Begin iterator.
Definition: vector_property.h:137
std::pair< std::vector< point >::const_iterator, std::vector< point >::const_iterator > origins() const
Origins iterator getter.
Definition: rows.h:100
std::pair< std::vector< entity_system::entity >::const_iterator, std::vector< entity_system::entity >::const_iterator > sites() const
Sites iterator getter.
Definition: rows.h:84
std::vector< T >::const_iterator end() const
End iterator.
Definition: vector_property.h:146
Rows class.
Definition: rows.h:34
rows(entity_system::entity_system &system)
Constructor.
Definition: rows.cpp:26
std::pair< std::vector< unsigned >::const_iterator, std::vector< unsigned >::const_iterator > number_of_sites() const
Number of sites iterator getter.
Definition: rows.h:92
point origin(entity_system::entity row) const
Row origin getter.
Definition: rows.h:75
entity_system::entity site(entity_system::entity row) const
Site getter.
Definition: rows.h:57
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