summaryrefslogtreecommitdiff
path: root/Ivy/Ivy.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:56:04 +0000
committerfcolin2007-02-01 12:56:04 +0000
commit8538e20f9ef0bb69a6b7a82f8b46e662d59ce398 (patch)
tree8a0c5010aaa53f1313fb656082c9716de243c5ac /Ivy/Ivy.cxx
parentb92f4c6128c14ad1c63a37a9d71cc2b0e42c056f (diff)
downloadivy-cplusplus-8538e20f9ef0bb69a6b7a82f8b46e662d59ce398.zip
ivy-cplusplus-8538e20f9ef0bb69a6b7a82f8b46e662d59ce398.tar.gz
ivy-cplusplus-8538e20f9ef0bb69a6b7a82f8b46e662d59ce398.tar.bz2
ivy-cplusplus-8538e20f9ef0bb69a6b7a82f8b46e662d59ce398.tar.xz
Utilisateur : Fcolin Date : 6/01/03 Heure : 14:47 Archivé dans $/Bus/Ivy Commentaire: (vss 14)
Diffstat (limited to 'Ivy/Ivy.cxx')
-rw-r--r--Ivy/Ivy.cxx29
1 files changed, 25 insertions, 4 deletions
diff --git a/Ivy/Ivy.cxx b/Ivy/Ivy.cxx
index e5b11ea..8b26e77 100644
--- a/Ivy/Ivy.cxx
+++ b/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 ] = "";