From 82d48a28226b7918a982add1f88b7e75f5ed7712 Mon Sep 17 00:00:00 2001
From: Jason Wang <wangr1@ornl.gov>
Date: Thu, 23 Feb 2017 11:29:39 -0500
Subject: [PATCH] added DataManager

---
 Makefile.libs                                 |  4 +--
 examples/hello/datamanReader/Makefile         |  5 +--
 examples/hello/datamanWriter/Makefile         |  5 +--
 .../helloDataManWriter_nompi.cpp              |  4 +--
 include/engine/dataman/DataManWriter.h        |  3 +-
 src/engine/dataman/DataManWriter.cpp          | 32 +++++++++++++++++--
 6 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/Makefile.libs b/Makefile.libs
index c0a08b1f0..ce4e77094 100644
--- a/Makefile.libs
+++ b/Makefile.libs
@@ -15,10 +15,10 @@ TRANSPORT_INC:=./include/transport
 TRANSPORT_SRC:=./src/transport
 
 ifeq ($(HAVE_DATAMAN),yes)
-    DATAMAN_LOC:=/home/wfg/Applications/DataMan# need to change this to your local dataman location
+    DATAMAN_LOC:=/Users/w4g/Dropbox/lib/DataMan# need to change this to your local dataman location
     CFLAGS += -DHAVE_DATAMAN
     INC += -I$(DATAMAN_LOC)/include
-    LIBS += -L$(DATAMAN_LOC)/lib -lcacheman -lstreamman -lzmqman
+    LIBS += -L$(DATAMAN_LOC)/lib -ldataman
 else
     HFiles:=$(filter-out $(ENGINE_INC)/dataman/DataManWriter.h,$(HFiles))
     HFiles:=$(filter-out $(ENGINE_INC)/dataman/DataManReader.h,$(HFiles))
diff --git a/examples/hello/datamanReader/Makefile b/examples/hello/datamanReader/Makefile
index 62ccd004b..e88977553 100644
--- a/examples/hello/datamanReader/Makefile
+++ b/examples/hello/datamanReader/Makefile
@@ -18,9 +18,10 @@ LIB_NOMPI+= $(ADIOS_DIR)/lib/libadios_nompi.a
 INC+= -I$(ADIOS_DIR)/include
 
 #DATAMAN
-DATAMAN_LOC=/home/wfg/Applications/DataMan
+DATAMAN_LOC=/Users/w4g/Dropbox/lib/DataMan
 INC+= -I$(DATAMAN_LOC)/include
-LIB+= -L$(DATAMAN_LOC)/lib -lcacheman -lstreamman -lzmqman
+LIB+= -L$(DATAMAN_LOC)/lib -ldataman
+LIB_NOMPI+= -L$(DATAMAN_LOC)/lib -ldataman
 
 #COMPILER FLAGS
 CFLAGS=-Wall -O0 -g -Wpedantic -std=c++11
diff --git a/examples/hello/datamanWriter/Makefile b/examples/hello/datamanWriter/Makefile
index e915be6bf..9f1a78619 100644
--- a/examples/hello/datamanWriter/Makefile
+++ b/examples/hello/datamanWriter/Makefile
@@ -18,9 +18,10 @@ LIB_NOMPI+= $(ADIOS_DIR)/lib/libadios_nompi.a
 INC+= -I$(ADIOS_DIR)/include
 
 #DATAMAN
-DATAMAN_LOC=/home/wfg/Applications/DataMan
+DATAMAN_LOC=/Users/w4g/Dropbox/lib/DataMan
 INC+= -I$(DATAMAN_LOC)/include
-LIB+= -L$(DATAMAN_LOC)/lib -lcacheman -lstreamman -lzmqman
+LIB+= -L$(DATAMAN_LOC)/lib -ldataman
+LIB_NOMPI+= -L$(DATAMAN_LOC)/lib -ldataman
 
 #COMPILER FLAGS
 CFLAGS=-Wall -O0 -g -Wpedantic -std=c++11
diff --git a/examples/hello/datamanWriter/helloDataManWriter_nompi.cpp b/examples/hello/datamanWriter/helloDataManWriter_nompi.cpp
index 9e591367c..792bc620e 100644
--- a/examples/hello/datamanWriter/helloDataManWriter_nompi.cpp
+++ b/examples/hello/datamanWriter/helloDataManWriter_nompi.cpp
@@ -28,8 +28,8 @@ int main( int argc, char* argv [] )
 
         //Define method for engine creation, it is basically straight-forward parameters
         adios::Method& datamanSettings = adios.DeclareMethod( "WAN", "DataManWriter" ); //default method type is Writer
-        datamanSettings.SetParameters( "peer-to-peer=yes", "real_time=yes", "compress=no" );
-        datamanSettings.AddTransport( "Mdtm", "localIP=128.0.0.0.1", "remoteIP=128.0.0.0.2", "tolerances=1,2,3" );
+        datamanSettings.SetParameters( "real_time=yes", "method_type=stream", "method=zmq", "local_ip=127.0.0.1", "remote_ip=127.0.0.1", "local_port=12306", "remote_port=12307" );
+//        datamanSettings.AddTransport( "Mdtm", "localIP=128.0.0.0.1", "remoteIP=128.0.0.0.2", "tolerances=1,2,3" );
         //datamanSettings.AddTransport( "ZeroMQ", "localIP=128.0.0.0.1.1", "remoteIP=128.0.0.0.2.1", "tolerances=1,2,3" ); not yet supported , will throw an exception
 
         //Create engine smart pointer to DataMan Engine due to polymorphism,
diff --git a/include/engine/dataman/DataManWriter.h b/include/engine/dataman/DataManWriter.h
index be07b1aba..ca4d9781f 100644
--- a/include/engine/dataman/DataManWriter.h
+++ b/include/engine/dataman/DataManWriter.h
@@ -18,7 +18,7 @@
 #include "capsule/heap/STLVector.h"
 
 
-#include "DataMan.h"  //here comes your DataMan header
+#include "DataManager.h"  //here comes your DataMan header
 
 
 namespace adios
@@ -79,6 +79,7 @@ private:
     format::BP1Writer m_BP1Writer; ///< format object will provide the required BP functionality to be applied on m_Buffer and m_Transports
 
     bool m_DoRealTime = false;
+    DataManager m_Man;
 
     void Init( );  ///< calls InitCapsules and InitTransports based on Method, called from constructor
     void InitCapsules( );
diff --git a/src/engine/dataman/DataManWriter.cpp b/src/engine/dataman/DataManWriter.cpp
index 13d1e41bb..824cf3a6e 100644
--- a/src/engine/dataman/DataManWriter.cpp
+++ b/src/engine/dataman/DataManWriter.cpp
@@ -53,10 +53,36 @@ void DataManWriter::Init( )
             m_DoRealTime = true;
     }
 
+    if(m_DoRealTime)
+    {
+        string method_type, method, local_ip, remote_ip;
+        int local_port, remote_port;
+
+        auto i = m_Method.m_Parameters.find( "method_type" );
+        if( i != m_Method.m_Parameters.end() )
+            method_type = i->second;
+        i = m_Method.m_Parameters.find( "method" );
+        if( i != m_Method.m_Parameters.end() )
+            method = i->second;
+        i = m_Method.m_Parameters.find( "local_ip" );
+        if( i != m_Method.m_Parameters.end() )
+            local_ip = i->second;
+        i = m_Method.m_Parameters.find( "remote_ip" );
+        if( i != m_Method.m_Parameters.end() )
+            remote_ip = i->second;
+        i = m_Method.m_Parameters.find( "local_port" );
+        if( i != m_Method.m_Parameters.end() )
+            istringstream(i->second) >> local_port;
+        i = m_Method.m_Parameters.find( "remote_port" );
+        if( i != m_Method.m_Parameters.end() )
+            istringstream(i->second) >> remote_port;
+    }
+    else
+    {
+        InitCapsules( );
+        InitTransports( );
+    }
 
-
-    InitCapsules( );
-    InitTransports( );
 }
 
 
-- 
GitLab