]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/value2os.h
Use std::lock_guard instead of STG_LOCKER.
[stg.git] / projects / stargazer / plugins / other / smux / value2os.h
index d17cb3574ba80579bd2d27351eaf5eb241c5f917..9084aa728bc7eff9a6ae57f09a74efc8a117cbee 100644 (file)
@@ -1,64 +1,61 @@
-#ifndef __VALUE_2_OS_H__
-#define __VALUE_2_OS_H__
+#pragma once
 
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include "stg/ObjectSyntax.h"
 #include "stg/ObjectSyntax.h"
+#pragma GCC diagnostic pop
+
+#include <string>
 
 template <typename T>
 
 template <typename T>
-bool ValueToOS(const T & value, ObjectSyntax * objectSyntax);
+void ValueToOS(const T & value, ObjectSyntax * objectSyntax);
 
 template <>
 inline
 
 template <>
 inline
-bool ValueToOS<int>(const int & value, ObjectSyntax * objectSyntax)
+void ValueToOS<int>(const int & value, ObjectSyntax * objectSyntax)
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
-return true;
 }
 
 template <>
 inline
 }
 
 template <>
 inline
-bool ValueToOS<unsigned int>(const unsigned int & value, ObjectSyntax * objectSyntax)
+void ValueToOS<unsigned int>(const unsigned int & value, ObjectSyntax * objectSyntax)
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
-return true;
 }
 
 template <>
 inline
 }
 
 template <>
 inline
-bool ValueToOS<long>(const long & value, ObjectSyntax * objectSyntax)
+void ValueToOS<long>(const long & value, ObjectSyntax * objectSyntax)
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
-return true;
 }
 
 template <>
 inline
 }
 
 template <>
 inline
-bool ValueToOS<unsigned long>(const unsigned long & value, ObjectSyntax * objectSyntax)
+void ValueToOS<unsigned long>(const unsigned long & value, ObjectSyntax * objectSyntax)
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_number;
 asn_long2INTEGER(&simpleSyntax->choice.number, value);
-return true;
 }
 
 template <>
 inline
 }
 
 template <>
 inline
-bool ValueToOS<std::string>(const std::string & value, ObjectSyntax * objectSyntax)
+void ValueToOS<std::string>(const std::string & value, ObjectSyntax * objectSyntax)
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_string;
 {
 objectSyntax->present = ObjectSyntax_PR_simple;
 SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple;
 simpleSyntax->present = SimpleSyntax_PR_string;
-OCTET_STRING_fromBuf(&simpleSyntax->choice.string, value.c_str(), value.length());
-return true;
+OCTET_STRING_fromBuf(&simpleSyntax->choice.string, value.c_str(), static_cast<int>(value.length()));
 }
 }
-
-#endif