summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:56:04 +0000
committerfcolin2007-02-01 12:56:04 +0000
commitbcdb533980f772c26191fc87bbf527f309605bc8 (patch)
treef437b9dc17089777fa2a51ea01f02b748c424125
parentac8907d98dddb7db4dd0f99e6ffd5e01e06080b0 (diff)
downloadivy-cplusplus-bcdb533980f772c26191fc87bbf527f309605bc8.zip
ivy-cplusplus-bcdb533980f772c26191fc87bbf527f309605bc8.tar.gz
ivy-cplusplus-bcdb533980f772c26191fc87bbf527f309605bc8.tar.bz2
ivy-cplusplus-bcdb533980f772c26191fc87bbf527f309605bc8.tar.xz
Utilisateur : Fcolin Date : 6/01/03 Heure : 14:47 Archivé dans $/Bus/Ivy Commentaire: (vss 14)
-rw-r--r--Bus/Ivy/Ivy.cxx29
1 files changed, 25 insertions, 4 deletions
diff --git a/Bus/Ivy/Ivy.cxx b/Bus/Ivy/Ivy.cxx
index e5b11ea..8b26e77 100644
--- a/Bus/Ivy/Ivy.cxx
+++ b/Bus/Ivy/Ivy.cxx
@@ -27,6 +27,7 @@ Ivy::~Ivy()
// remove all app and stop watcher
stop();
regexp_out.clear();
+
if ( synchronous )
{
@@ -55,7 +56,7 @@ Ivy::~Ivy()
Ivy::Ivy(const char* name, const char * ready, IvyApplicationCallback *callback, bool Synchronous)
{
InitializeCriticalSection( &m_application_cs );
-
+ regexp_id = 0;
synchronous = Synchronous;
if ( synchronous )
IvySynchronousCallback::m_synchro = new IvySynchroWnd();
@@ -129,7 +130,6 @@ void Ivy::stop()
}
int Ivy::BindMsg(const char *regexp, IvyMessageCallback *cb)
{
- static int id = 0;
regexp_out.push_back( regexp );
callbacks.push_back( synchronous ? new IvySynchronousMessageCallback(cb) : cb );
@@ -138,11 +138,32 @@ int Ivy::BindMsg(const char *regexp, IvyMessageCallback *cb)
for ( iter = applications.begin() ; iter != applications.end() ; ++iter )
{
IvyApplication *app = *iter;
- app->SendMsg(IvyApplication::AddRegexp, id, regexp );
+ app->SendMsg(IvyApplication::AddRegexp, regexp_id, regexp );
}
- return id++;
+ return regexp_id++;
}
+int Ivy::BindMsg( IvyMessageCallback *cb, const char *regexp, ... )
+{
+ char buffer[4096];
+ va_list args;
+
+ va_start( args, regexp ); /* Initialize variable arguments. */
+ vsprintf( buffer, regexp, args );
+ va_end( args);
+
+ regexp_out.push_back( regexp );
+ callbacks.push_back( synchronous ? new IvySynchronousMessageCallback(cb) : cb );
+ /* send to already connected */
+ IvyApplicationList::iterator iter;
+ for ( iter = applications.begin() ; iter != applications.end() ; ++iter )
+ {
+ IvyApplication *app = *iter;
+ app->SendMsg(IvyApplication::AddRegexp, regexp_id, buffer );
+ }
+ return regexp_id++;
+}
+
void Ivy::UnbindMsg(int id)
{
regexp_out[ id ] = "";