--------------------------------------------------- ----------------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- OCARINA.BUILDER.COMPONENTS.CONNECTIONS -- -- -- -- B o d y -- -- -- -- Copyright (C) 2005-2007, GET-Telecom Paris. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. Ocarina is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with Ocarina; see file COPYING. -- -- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth -- -- Floor, Boston, MA 02111-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- Ocarina is maintained by the Ocarina team -- -- (ocarina-users@listes.enst.fr) -- -- -- ------------------------------------------------------------------------------ with Ocarina.Nutils; with Ocarina.Nodes; package body Ocarina.Builder.Components.Connections is ------------------------------ -- Add_Property_Association -- ------------------------------ function Add_Property_Association (Connection : node_id; Property_Association : node_id) return Boolean is use Ocarina.Nodes; use Ocarina.Nutils; pragma assert (Connection /= No_Node and then Kind (Connection) = k_connection); pragma assert (Property_Association /= No_Node); begin if Is_Empty (Ocarina.Nodes.Properties (Connection)) then Set_Properties (Connection, New_List (k_list_id, Loc (Property_Association))); end if; Append_Node_To_List (Property_Association, Ocarina.Nodes.Properties (Connection)); return True; end Add_Property_Association; ------------------------ -- Add_New_Connection -- ------------------------ function Add_New_Connection (Loc : location; Name : node_id; Comp_Impl : node_id; Category : Ocarina.Entities.Components.Connections.connection_type; Is_Refinement : Boolean := False; Source : node_id := No_Node; Destination : node_id := No_Node; In_Modes : node_id := No_Node) return node_id is use Ocarina.Nutils; use Ocarina.Nodes; use Ocarina.Entities.Components.Connections; pragma assert (Kind (Comp_Impl) = k_component_implementation); Node : constant node_id := New_Node (k_connection, Loc); Success : Boolean := True; begin Set_Identifier (Node, Name); if Name /= No_Node then Set_Corresponding_Entity (Name, Node); end if; Set_Is_Refinement (Node, Is_Refinement); Set_Source (Node, Source); Set_Destination (Node, Destination); Set_Category (Node, connection_type'pos (Category)); Set_In_Modes (Node, In_Modes); Set_Properties (Node, No_List); Set_Property_Scope (Node, New_Node (k_scope_definition, Loc)); Set_Corresponding_Entity (Property_Scope (Node), Node); Set_Scoped_Identifiers (Property_Scope (Node), No_Node); Success := Add_Connection (Component => Comp_Impl, Connection => Node); if Success then return Node; else return No_Node; end if; end Add_New_Connection; end Ocarina.Builder.Components.Connections;