File name format change and Removed warning messages (Except warning from boost for Logging)

Change-Id: If3a3a5411d377d925527fc3e8809c228a9a81e26
diff --git a/src/utility/logger.cpp b/src/utility/logger.cpp
new file mode 100644
index 0000000..3d9a804
--- /dev/null
+++ b/src/utility/logger.cpp
@@ -0,0 +1,59 @@
+#include "logger.hpp"
+
+namespace nlsr {
+
+string
+Logger::getEpochTime()
+{
+  std::stringstream ss;
+  boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970, 1, 1));
+  boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
+  boost::posix_time::time_duration diff = now - time_t_epoch;
+  ss << diff.total_seconds() << "." << boost::format("%06i") %
+     (diff.total_microseconds()
+      % 1000000);
+  return ss.str();
+}
+
+string
+Logger::getUserHomeDirectory()
+{
+  string homeDirPath(getpwuid(getuid())->pw_dir);
+  if (homeDirPath.empty())
+  {
+    homeDirPath = getenv("HOME");
+  }
+  return homeDirPath;
+}
+
+void
+Logger::initialize(std::string dirPath)
+{
+  string logDirPath(dirPath);
+  if (dirPath.empty())
+  {
+    logDirPath = getUserHomeDirectory() + "/nlsrLog";
+  }
+  cout << "Log Dir Path: " << logDirPath << endl;
+  typedef sinks::synchronous_sink<sinks::text_file_backend> file_sink;
+  shared_ptr<file_sink> sink(new file_sink(
+                               keywords::file_name = logDirPath
+                                                     + "/NLSR%Y%m%d%H%M%S_%3N.log",
+                               keywords::rotation_size = 16 * 1024 * 1024,
+                               keywords::time_based_rotation = sinks::file::rotation_at_time_point(12, 0, 0),
+                               keywords::auto_flush = true
+                             ));
+  sink->locked_backend()->set_file_collector(sinks::file::make_collector(
+                                               keywords::target = logDirPath,
+                                               //keywords::max_size =  512 * 1024 * 1024,
+                                               keywords::min_free_space = 64 * 1024 * 1024
+                                             ));
+  sink->set_formatter(
+    expr::format("%1% %2%")
+    % getEpochTime()
+    % expr::smessage
+  );
+  logging::core::get()->add_sink(sink);
+}
+
+}//namespace nlsr
diff --git a/src/utility/logger.hpp b/src/utility/logger.hpp
new file mode 100644
index 0000000..97b8df4
--- /dev/null
+++ b/src/utility/logger.hpp
@@ -0,0 +1,64 @@
+#ifndef NLSR_LOGGER_HPP
+#define NLSR_LOGGER_HPP
+
+#define BOOST_LOG_DYN_LINK 1
+#include "boost-log.hpp"
+
+#include <stdexcept>
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <pwd.h>
+#include <cstdlib>
+#include <string>
+#include <unistd.h>
+#include <boost/format.hpp>
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/local_time/local_time.hpp>
+
+
+
+
+namespace nlsr {
+
+namespace logging = boost::log;
+namespace attrs = boost::log::attributes;
+namespace src = boost::log::sources;
+namespace sinks = boost::log::sinks;
+namespace expr = boost::log::expressions;
+namespace keywords = boost::log::keywords;
+
+using boost::shared_ptr;
+using namespace std;
+
+
+class Logger
+{
+public:
+  Logger()
+  {
+  }
+
+  void
+  initialize(std::string dirPath);
+
+  src::logger&
+  getLogger()
+  {
+    return m_Logger;
+  }
+
+private:
+  string
+  getEpochTime();
+
+  string
+  getUserHomeDirectory();
+
+private:
+  src::logger m_Logger;
+};
+
+}//namespace nlsr
+#endif //NLSR_LOGGER_HPP
diff --git a/src/utility/nlsr_logger.cpp b/src/utility/nlsr_logger.cpp
deleted file mode 100644
index f214c6a..0000000
--- a/src/utility/nlsr_logger.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "nlsr_logger.hpp"
-
-namespace nlsr
-{
-
-  string
-  NlsrLogger::getEpochTime()
-  {
-    std::stringstream ss;
-    boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
-    boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
-    boost::posix_time::time_duration diff = now - time_t_epoch;
-    ss<<diff.total_seconds()<<"."<<boost::format("%06i")%(diff.total_microseconds()
-        %1000000);
-    return ss.str();
-  }
-
-  string
-  NlsrLogger::getUserHomeDirectory()
-  {
-    string homeDirPath(getpwuid(getuid())->pw_dir);
-    if( homeDirPath.empty() )
-    {
-      homeDirPath = getenv("HOME");
-    }
-    return homeDirPath;
-  }
-
-  void
-  NlsrLogger::initNlsrLogger(std::string dirPath)
-  {
-    string logDirPath(dirPath);
-    if( dirPath.empty() )
-    {
-      logDirPath=getUserHomeDirectory()+"/nlsrLog";
-    }
-    cout<<"Log Dir Path: "<< logDirPath<<endl;
-    typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
-    shared_ptr< file_sink > sink(new file_sink(
-                                   keywords::file_name = logDirPath
-                                       +"/NLSR%Y%m%d%H%M%S_%3N.log",
-                                   keywords::rotation_size = 16 * 1024 * 1024,
-                                   keywords::time_based_rotation = sinks::file::rotation_at_time_point(12, 0, 0),
-                                   keywords::auto_flush = true
-                                 ));
-    sink->locked_backend()->set_file_collector(sinks::file::make_collector(
-          keywords::target = logDirPath,
-          //keywords::max_size =  512 * 1024 * 1024,
-          keywords::min_free_space = 64 * 1024 * 1024
-        ));
-    sink->set_formatter(
-      expr::format("%1% %2%")
-      % getEpochTime()
-      % expr::smessage
-    );
-    logging::core::get()->add_sink(sink);
-  }
-
-}//namespace nlsr
diff --git a/src/utility/nlsr_logger.hpp b/src/utility/nlsr_logger.hpp
deleted file mode 100644
index ca6be3e..0000000
--- a/src/utility/nlsr_logger.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef NLSR_LOGGER_HPP
-#define NLSR_LOGGER_HPP
-
-#define BOOST_LOG_DYN_LINK 1
-#include "boost-log.hpp"
-
-#include <stdexcept>
-#include <string>
-#include <iostream>
-#include <sstream>
-#include <pwd.h>
-#include <cstdlib>
-#include <string>
-#include <unistd.h>
-#include <boost/format.hpp>
-#include <boost/smart_ptr/shared_ptr.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/date_time/local_time/local_time.hpp>
-
-
-
-
-namespace nlsr
-{
-
-  namespace logging = boost::log;
-  namespace attrs = boost::log::attributes;
-  namespace src = boost::log::sources;
-  namespace sinks = boost::log::sinks;
-  namespace expr = boost::log::expressions;
-  namespace keywords = boost::log::keywords;
-
-  using boost::shared_ptr;
-  using namespace std;
-
-
-  class NlsrLogger
-  {
-  public:
-    NlsrLogger()
-    {
-    }
-
-    void initNlsrLogger(std::string dirPath);
-
-    src::logger& getLogger()
-    {
-      return mLogger;
-    }
-
-  private:
-    string getEpochTime();
-    string getUserHomeDirectory();
-
-  private:
-    src::logger mLogger;
-  };
-
-}//namespace nlsr
-#endif
diff --git a/src/utility/nlsr_tokenizer.cpp b/src/utility/nlsr_tokenizer.cpp
deleted file mode 100644
index a1ed2bd..0000000
--- a/src/utility/nlsr_tokenizer.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include <iostream>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-#include <string>
-#include <algorithm>
-
-#include "nlsr_tokenizer.hpp"
-
-namespace nlsr
-{
-
-  using namespace std;
-  using namespace boost;
-
-  void
-  nlsrTokenizer::makeToken()
-  {
-    char_separator<char> sep(m_seps.c_str());
-    tokenizer< char_separator<char> >tokens(m_originalString, sep);
-    tokenizer< char_separator<char> >::iterator tok_iter = tokens.begin();
-    for ( ; tok_iter != tokens.end(); ++tok_iter)
-    {
-      string oneToken(*tok_iter);
-      trim(oneToken);
-      if(!oneToken.empty())
-      {
-        insertToken(oneToken);
-      }
-    }
-    m_firstToken=m_vTokenList[0];
-    makeRestOfTheLine();
-  }
-
-  void
-  nlsrTokenizer::insertToken(const string& token)
-  {
-    m_tokenList.push_back(token);
-    m_vTokenList.push_back(token);
-  }
-
-  int
-  nlsrTokenizer::getTokenPosition(string& token)
-  {
-    int pos=-1;
-    int i=0;
-    for(std::list<string>::iterator it=m_tokenList.begin();
-        it!=m_tokenList.end(); it++)
-    {
-      if( (*it) == token )
-      {
-        break;
-      }
-      i++;
-    }
-    if( i < m_tokenList.size() )
-    {
-      pos=i;
-    }
-    return pos;
-  }
-
-  string
-  nlsrTokenizer::getTokenString(int from , int to)
-  {
-    string returnString="";
-    if((from>=0 && to<m_tokenList.size()) &&
-        (to>=from && to <m_tokenList.size()))
-    {
-      for(int i=from; i<=to; i++)
-      {
-        returnString+=m_seps;
-        returnString+=m_vTokenList[i];
-      }
-    }
-    trim(returnString);
-    return returnString;
-  }
-
-  string
-  nlsrTokenizer::getTokenString(int from)
-  {
-    return getTokenString(from,m_tokenList.size()-1);
-  }
-
-  static bool
-  tokenCompare(string& s1, string& s2)
-  {
-    return s1==s2;
-  }
-
-  void
-  nlsrTokenizer::makeRestOfTheLine()
-  {
-    m_restOfTheLine=getTokenString(1);
-  }
-
-  bool
-  nlsrTokenizer::doesTokenExist(string token)
-  {
-    std::list<string >::iterator it = std::find_if( m_tokenList.begin(),
-                                      m_tokenList.end(),
-                                      bind(&tokenCompare, _1 , token));
-    if( it != m_tokenList.end() )
-    {
-      return true;
-    }
-    return false;
-  }
-
-}//namespace nlsr
diff --git a/src/utility/nlsr_tokenizer.hpp b/src/utility/nlsr_tokenizer.hpp
deleted file mode 100644
index 02d6eea..0000000
--- a/src/utility/nlsr_tokenizer.hpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef NLSR_TOKENIZER_HPP
-#define NLSR_TOKENIZER_HPP
-
-#include <iostream>
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-#include <string>
-#include <list>
-#include <vector>
-#include <ndn-cpp-dev/face.hpp>
-
-namespace nlsr
-{
-
-  using namespace std;
-  using namespace boost;
-
-  class nlsrTokenizer
-  {
-  public:
-    nlsrTokenizer(const string& inputString)
-      : m_firstToken()
-      , m_restOfTheLine()
-      , m_currentPosition(0)
-    {
-      m_seps = " ";
-      m_originalString = inputString;
-      makeToken();
-    }
-
-    nlsrTokenizer(const string& inputString, const string& separator)
-      : m_firstToken()
-      , m_restOfTheLine()
-      , m_currentPosition(0)
-    {
-      m_seps = separator;
-      m_originalString = inputString;
-      makeToken();
-    }
-
-    string getFirstToken()
-    {
-      return m_firstToken;
-    }
-
-    string getRestOfLine()
-    {
-      return m_restOfTheLine;
-    }
-
-    void resetCurrentPosition(uint32_t cp=0)
-    {
-      if( cp >=0 && cp <= m_vTokenList.size() )
-      {
-        m_currentPosition=cp;
-      }
-    }
-
-    string getNextToken()
-    {
-      if(m_currentPosition >= 0 && m_currentPosition <= (m_vTokenList.size()-1))
-      {
-        return m_vTokenList[m_currentPosition++];
-      }
-      return "";
-    }
-
-    uint32_t getTokenNumber()
-    {
-      return m_tokenList.size();
-    }
-
-    string getToken(int position)
-    {
-      if( position >=0 && position <m_vTokenList.size() )
-      {
-        return m_vTokenList[position];
-      }
-      return "";
-    }
-
-    int getTokenPosition(string& token);
-    string getTokenString(int from , int to);
-    string getTokenString(int from);
-    bool doesTokenExist(string token);
-
-
-  private:
-
-    void makeToken();
-    void insertToken(const string& token);
-    void makeRestOfTheLine();
-
-    string m_seps;
-    string m_originalString;
-    string m_firstToken;
-    string m_restOfTheLine;
-    std::list<string> m_tokenList;
-    std::vector<string> m_vTokenList;
-    uint32_t m_currentPosition;
-  };
-
-}//namespace nlsr
-#endif
diff --git a/src/utility/tokenizer.cpp b/src/utility/tokenizer.cpp
new file mode 100644
index 0000000..e326c2a
--- /dev/null
+++ b/src/utility/tokenizer.cpp
@@ -0,0 +1,109 @@
+#include <iostream>
+#include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
+#include <string>
+#include <algorithm>
+
+#include "tokenizer.hpp"
+
+namespace nlsr {
+
+using namespace std;
+using namespace boost;
+
+void
+Tokenizer::makeToken()
+{
+  char_separator<char> sep(m_seps.c_str());
+  tokenizer<char_separator<char> >tokens(m_originalString, sep);
+  tokenizer<char_separator<char> >::iterator tok_iter = tokens.begin();
+  for (; tok_iter != tokens.end(); ++tok_iter)
+  {
+    string oneToken(*tok_iter);
+    trim(oneToken);
+    if (!oneToken.empty())
+    {
+      insertToken(oneToken);
+    }
+  }
+  m_firstToken = m_vTokenList[0];
+  makeRestOfTheLine();
+}
+
+void
+Tokenizer::insertToken(const string& token)
+{
+  m_tokenList.push_back(token);
+  m_vTokenList.push_back(token);
+}
+
+uint32_t
+Tokenizer::getTokenPosition(string& token)
+{
+  int pos = -1;
+  int i = 0;
+  for (std::list<string>::iterator it = m_tokenList.begin();
+       it != m_tokenList.end(); it++)
+  {
+    if ((*it) == token)
+    {
+      break;
+    }
+    i++;
+  }
+  if (i < m_tokenList.size())
+  {
+    pos = i;
+  }
+  return pos;
+}
+
+string
+Tokenizer::getTokenString(uint32_t from , uint32_t to)
+{
+  string returnString = "";
+  if ((to < m_tokenList.size()) &&
+      (to >= from && to < m_tokenList.size()))
+  {
+    for (int i = from; i <= to; i++)
+    {
+      returnString += m_seps;
+      returnString += m_vTokenList[i];
+    }
+  }
+  trim(returnString);
+  return returnString;
+}
+
+string
+Tokenizer::getTokenString(uint32_t from)
+{
+  return getTokenString(from, m_tokenList.size() - 1);
+}
+
+static bool
+tokenCompare(string& s1, string& s2)
+{
+  return s1 == s2;
+}
+
+void
+Tokenizer::makeRestOfTheLine()
+{
+  m_restOfTheLine = getTokenString(1);
+}
+
+bool
+Tokenizer::doesTokenExist(string token)
+{
+  std::list<string>::iterator it = std::find_if(m_tokenList.begin(),
+                                                m_tokenList.end(),
+                                                bind(&tokenCompare, _1 , token));
+  if (it != m_tokenList.end())
+  {
+    return true;
+  }
+  return false;
+}
+
+}//namespace nlsr
diff --git a/src/utility/tokenizer.hpp b/src/utility/tokenizer.hpp
new file mode 100644
index 0000000..dd6254d
--- /dev/null
+++ b/src/utility/tokenizer.hpp
@@ -0,0 +1,118 @@
+#ifndef NLSR_TOKENIZER_HPP
+#define NLSR_TOKENIZER_HPP
+
+#include <iostream>
+#include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
+#include <string>
+#include <list>
+#include <vector>
+#include <ndn-cpp-dev/face.hpp>
+
+namespace nlsr {
+
+class Tokenizer
+{
+public:
+  Tokenizer(const std::string& inputString)
+    : m_firstToken()
+    , m_restOfTheLine()
+    , m_currentPosition(0)
+  {
+    m_seps = " ";
+    m_originalString = inputString;
+    makeToken();
+  }
+
+  Tokenizer(const std::string& inputString, const std::string& separator)
+    : m_firstToken()
+    , m_restOfTheLine()
+    , m_currentPosition(0)
+  {
+    m_seps = separator;
+    m_originalString = inputString;
+    makeToken();
+  }
+
+  std::string
+  getFirstToken()
+  {
+    return m_firstToken;
+  }
+
+  std::string
+  getRestOfLine()
+  {
+    return m_restOfTheLine;
+  }
+
+  void
+  resetCurrentPosition(uint32_t cp = 0)
+  {
+    if (cp <= m_vTokenList.size())
+    {
+      m_currentPosition = cp;
+    }
+  }
+
+  std::string
+  getNextToken()
+  {
+    if (m_currentPosition <= (m_vTokenList.size() - 1))
+    {
+      return m_vTokenList[m_currentPosition++];
+    }
+    return "";
+  }
+
+  uint32_t
+  getTokenNumber()
+  {
+    return m_tokenList.size();
+  }
+
+  std::string
+  getToken(unsigned int position)
+  {
+    if (position < m_vTokenList.size())
+    {
+      return m_vTokenList[position];
+    }
+    return "";
+  }
+
+  uint32_t
+  getTokenPosition(std::string& token);
+
+  std::string
+  getTokenString(uint32_t from , uint32_t to);
+
+  std::string
+  getTokenString(uint32_t from);
+
+  bool
+  doesTokenExist(std::string token);
+
+
+private:
+
+  void
+  makeToken();
+
+  void
+  insertToken(const std::string& token);
+
+  void
+  makeRestOfTheLine();
+
+  std::string m_seps;
+  std::string m_originalString;
+  std::string m_firstToken;
+  std::string m_restOfTheLine;
+  std::list<std::string> m_tokenList;
+  std::vector<std::string> m_vTokenList;
+  uint32_t m_currentPosition;
+};
+
+}//namespace nlsr
+#endif //NLSR_TOKENIZER_HPP