3
Copyright (C) 2000 Stefan Westerfeld
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
Permission is also granted to link this program with the Qt
21
library, treating Qt like a library that normally accompanies the
22
operating system kernel, whether or not that is in fact the case.
26
#include "moduleinfo.h"
30
static void gatherPorts(Arts::InterfaceDef& idef, Arts::ModuleInfo& minfo,
31
map<string, bool>& done)
33
Arts::InterfaceRepo interfaceRepo=Arts::Dispatcher::the()->interfaceRepo();
35
vector<string>::iterator ii = idef.inheritedInterfaces.begin();
36
while(ii != idef.inheritedInterfaces.end())
38
Arts::InterfaceDef inherited = interfaceRepo.queryInterface(*ii++);
39
gatherPorts(inherited,minfo,done);
42
if(idef.name == "Arts::Object" || idef.name == "Arts::SynthModule")
44
// don't gather members of these basic interfaces as ports
47
vector<Arts::AttributeDef>::iterator i;
48
for(i=idef.attributes.begin(); i != idef.attributes.end(); i++)
50
// 1 = direction, 10000 = connectiontype
54
if(i->flags & Arts::streamIn)
56
ptype.direction = Arts::input;
59
else if(i->flags & Arts::streamOut)
61
ptype.direction = Arts::output;
65
ptype.dataType = i->type;
67
if(i->flags & Arts::attributeStream)
69
ptype.connType = Arts::conn_stream;
72
else if(i->flags & Arts::attributeAttribute)
74
ptype.connType = Arts::conn_property;
78
ptype.isMultiPort = (i->flags & Arts::streamMulti);
80
if(complete == 10001 && !done[i->name])
82
minfo.portnames.push_back(i->name);
83
minfo.ports.push_back(ptype);
89
Arts::ModuleInfo makeModuleInfo(const string& name)
91
Arts::InterfaceRepo interfaceRepo=Arts::Dispatcher::the()->interfaceRepo();
92
Arts::InterfaceDef idef = interfaceRepo.queryInterface(name);
93
Arts::ModuleInfo minfo;
97
map<string,bool> done;
99
minfo.isStructure = false;
100
minfo.isInterface = false;
102
gatherPorts(idef,minfo,done);