Ophidian
 All Classes Namespaces Functions
nets.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 SRC_NETLIST_NETS_H_
22 #define SRC_NETLIST_NETS_H_
23 
24 #include <vector>
25 #include "../entity_system/entity_system.h"
26 #include "../entity_system/vector_property.h"
27 #include <utility>
28 
29 namespace ophidian {
30 namespace netlist {
31 
32 class nets {
34 
37 
38 public:
40  virtual ~nets();
41 
42  std::string name(entity_system::entity net) const {
43  return m_names[m_system.lookup(net)];
44  }
45  const std::vector<entity_system::entity> & pins(entity_system::entity net) const {
46  return m_pins[m_system.lookup(net)];
47  }
48  std::pair< std::vector<std::string>::const_iterator, std::vector<std::string>::const_iterator > names() const {
49  return std::make_pair(m_names.begin(), m_names.end());
50  }
51 
52  std::pair< std::vector<std::vector<entity_system::entity>>::const_iterator, std::vector<std::vector<entity_system::entity>>::const_iterator > pins() const {
53  return std::make_pair(m_pins.begin(), m_pins.end());
54  }
55 
56  void connect(entity_system::entity net, entity_system::entity pin);
57  void disconnect(entity_system::entity net, entity_system::entity pin);
58  void pins(entity_system::entity net, std::vector<entity_system::entity> pins);
59  void name(entity_system::entity net, std::string name);
60 
61 
62  void preallocate_pins(entity_system::entity net, std::size_t pin_count);
63 };
64 
65 } /* namespace netlist */
66 } /* namespace ophidian */
67 
68 #endif /* SRC_NETLIST_NETS_H_ */
Definition: nets.h:32
Implementation of the vector property class.
Definition: vector_property.h:37
entity_system class.
Definition: entity_system.h:40
Definition: pins.h:31
entity_index lookup(entity e) const
Gets the index of an entity.
Definition: entity_system.h:149