summaryrefslogtreecommitdiff
path: root/Bus/Ivy/IvyApplication.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:59:31 +0000
committerfcolin2007-02-01 12:59:31 +0000
commit330ff9be895d1aa26ce08ce58fcc62397513dfe0 (patch)
tree90a83abb5451ea0a5571df8565ad7417cf6c8d33 /Bus/Ivy/IvyApplication.cxx
parent0983a120d5ef82caa5a68262d6b3c02f6af08e43 (diff)
downloadivy-cplusplus-330ff9be895d1aa26ce08ce58fcc62397513dfe0.zip
ivy-cplusplus-330ff9be895d1aa26ce08ce58fcc62397513dfe0.tar.gz
ivy-cplusplus-330ff9be895d1aa26ce08ce58fcc62397513dfe0.tar.bz2
ivy-cplusplus-330ff9be895d1aa26ce08ce58fcc62397513dfe0.tar.xz
Utilisateur : Fcolin Date : 20/07/00 Heure : 10:57 Archivé dans $/Ivy (vss 2)
Diffstat (limited to 'Bus/Ivy/IvyApplication.cxx')
-rw-r--r--Bus/Ivy/IvyApplication.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/Bus/Ivy/IvyApplication.cxx b/Bus/Ivy/IvyApplication.cxx
index 26d0adf..de43bd0 100644
--- a/Bus/Ivy/IvyApplication.cxx
+++ b/Bus/Ivy/IvyApplication.cxx
@@ -129,20 +129,18 @@ void IvyApplication::OnReceive(char * line)
TRACE("IvyApplication %s\n",err.c_str());
return;
}
- if ( id +1 < regexp_in.size() )
- regexp_in[ id ] = exp ;
- else regexp_in.push_back( exp );
+ regexp_in[ id ] = exp ;
break;
case DelRegexp:
#ifdef DEBUG
TRACE("Regexp Delete id=%d\n", id);
#endif //DEBUG
- if ( id < regexp_in.size() )
+ if ( regexp_in.find(id) != regexp_in.end() )
{
exp = regexp_in[ id ];
delete exp;
- regexp_in[ id ] = NULL ;
+ regexp_in.erase( id );
}
break;
case StartRegexp:
@@ -263,11 +261,12 @@ int IvyApplication::SendMsg(const char *message)
{
int count = 0;
Regexp *exp;
-
+ map<int,Regexp*>::iterator iter;
/* send to already connected */
- for ( int id = 0; id < regexp_in.size(); id++ )
+ if ( !regexp_in.empty() )
+ for ( iter = regexp_in.begin(); iter != regexp_in.end(); iter++ )
{
- exp = regexp_in[ id ];
+ exp = (*iter).second;
if ( exp && exp->Match( message ) )
{
@@ -277,7 +276,7 @@ int IvyApplication::SendMsg(const char *message)
buffer += (*exp)[i];
buffer += ARG_END;
}
- SendMsg( Msg, id, buffer.c_str() );
+ SendMsg( Msg, (*iter).first, buffer.c_str() );
count++;
}
}