Remove dynamic exceptions
[anna.git] / example / diameter / launcher / MyCounterRecorder.cpp
index 4f62f72..3d6efab 100644 (file)
@@ -7,7 +7,7 @@
 
 
 // Process
-#include "MyCounterRecorder.hpp"
+#include <MyCounterRecorder.hpp>
 
 
 MyCounterRecorder::MyCounterRecorder(const std::string &fnp) : a_stream(-1), a_fileNamePrefix(fnp) {
@@ -15,7 +15,7 @@ MyCounterRecorder::MyCounterRecorder(const std::string &fnp) : a_stream(-1), a_f
 }
 
 // pure virtual definitions:
-void MyCounterRecorder::open() throw(anna::RuntimeException) {
+void MyCounterRecorder::open() noexcept(false) {
        static char str [256];
        const time_t now = ::time(NULL);
        struct tm tmNow;
@@ -34,7 +34,7 @@ void MyCounterRecorder::open() throw(anna::RuntimeException) {
          anna::Logger::debug(msg, ANNA_FILE_LOCATION);
        );
 
-       if((a_stream = ::open(a_fileName.c_str(), O_WRONLY | O_CREAT, S_IWUSR)) == -1)
+       if((a_stream = ::open(a_fileName.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH /*0644*/)) == -1)
          throw RuntimeException(anna::functions::asString("Error opening file '%s'; errno = %d", a_fileName.c_str(), errno), ANNA_FILE_LOCATION);
 
        sprintf(str, "%04d-%02d-%02d %02d:%02d|%04d-%02d-%02d %02d:%02d",
@@ -46,7 +46,7 @@ void MyCounterRecorder::open() throw(anna::RuntimeException) {
        a_fixedLine = str;
 }
 
-void MyCounterRecorder::apply(const anna::oam::Counter& counter) throw(anna::RuntimeException) {
+void MyCounterRecorder::apply(const anna::oam::Counter& counter) noexcept(false) {
        static char line [356];
        anna::oam::Counter::type_t value = counter;
        sprintf(line, "%s|%06d|%07u|%s\n", a_fixedLine.c_str(), counter.getReference(), value, counter.getName().c_str());
@@ -55,17 +55,17 @@ void MyCounterRecorder::apply(const anna::oam::Counter& counter) throw(anna::Run
          throw RuntimeException(anna::functions::asString("Error writting to file '%s'; errno = %d", a_fileName.c_str(), errno), ANNA_FILE_LOCATION);
 }
 
-void MyCounterRecorder::close() throw() {
+void MyCounterRecorder::close() {
        if(a_stream != -1) {
          ::close(a_stream);
          a_stream = -1;
        }
 
-chmod(a_fileName.c_str(), S_IWUSR | S_IRUSR);
+//chmod(a_fileName.c_str(), S_IWUSR | S_IRUSR);
 a_previousTime = ::time(NULL);
 }
 
-std::string MyCounterRecorder::asString() const throw() {
+std::string MyCounterRecorder::asString() const {
   std::string result = "Physical counters dump at file '";
   result += a_fileName;
   result += "'. Another way to see counters: context dump (kill -10 <pid>";