Ophidian
 All Classes Namespaces Functions
subrows.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_ABACUS_SUBROWS_H
22 #define OPHIDIAN_ABACUS_SUBROWS_H
23 
24 #include <vector_property.h>
25 #include <placement.h>
26 #include "../subrows.h"
27 #include "entity.h"
28 
29 namespace ophidian {
30  namespace placement {
31  namespace legalization {
32  namespace abacus {
33  class subrows {
35 
38  public:
39  subrows(entity_system::entity_system &m_system) : m_system(m_system) {
40  m_system.register_property(&m_cells);
41  m_system.register_property(&m_capacity);
42  }
43 
44  const std::vector<entity_system::entity> & cells(entity_system::entity row) {
45  return m_cells[m_system.lookup(row)];
46  }
47  bool insert_cell(entity_system::entity row, entity_system::entity cell, double cell_width);
48  void remove_last_cell(entity_system::entity row, double cell_width);
49 
50  double capacity(entity_system::entity row) {
51  return m_capacity[m_system.lookup(row)];
52  }
53  void capacity(entity_system::entity row, double capacity);
54 
55  };
56  }
57  }
58  }
59 }
60 
61 
62 #endif //OPHIDIAN_ABACUS_SUBROWS_H
Implementation of the vector property class.
Definition: vector_property.h:37
entity_system class.
Definition: entity_system.h:40
Definition: abacus.h:92
entity_index lookup(entity e) const
Gets the index of an entity.
Definition: entity_system.h:149
void register_property(property *property)
Registers property.
Definition: entity_system.cpp:61