X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fe2apv1sim%2Fsrc%2FASN1%2Fasn%2Fber%2Fcontext.hpp;fp=e2sim%2Fe2apv1sim%2Fsrc%2FASN1%2Fasn%2Fber%2Fcontext.hpp;h=0000000000000000000000000000000000000000;hp=4159f0083fe3ad8a89cf7628a1e6b9f461614eaa;hb=a9733dbcc47e93a3b2843056f1d587196296c324;hpb=3ebf932d23dcbec9ed19f4a51f9d00a0a54f5124 diff --git a/e2sim/e2apv1sim/src/ASN1/asn/ber/context.hpp b/e2sim/e2apv1sim/src/ASN1/asn/ber/context.hpp deleted file mode 100755 index 4159f00..0000000 --- a/e2sim/e2apv1sim/src/ASN1/asn/ber/context.hpp +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once -/****************************************************************************** -* -* Copyright (c) 2019 AT&T Intellectual Property. -* Copyright (c) 2018-2019 Nokia. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -******************************************************************************/ - -// Standard Includes: ANSI C/C++, MSA, and Third-Party Libraries -#include - -// Local Includes: Application specific classes, functions, and libraries -#include "asn/utility.hpp" -#include "asn/buffer.hpp" -#include "asn/error_context.hpp" - -namespace asn { -namespace ber { - -/******************************************************************************** -EncoderCtx -*********************************************************************************/ -class EncoderCtx : boost::noncopyable -{ -public: - typedef buffer buf_type; - - EncoderCtx(u8* data, size_t size) - : m_buffer{ m_errCtx } - { - Reset(data, size); - } - - template - explicit EncoderCtx(u8(&buff)[SIZE]) - : EncoderCtx(buff, SIZE) - { - } - - explicit EncoderCtx() - : EncoderCtx(nullptr, 0) - { - } - - buf_type& refBuffer() { return m_buffer; } - error_context& refErrorCtx() { return m_errCtx; } - explicit operator bool() const { return static_cast(m_errCtx); } - - void Reset(void* data = nullptr, size_t size = 0) - { - m_buffer.reset(static_cast(data), size); - m_errCtx.reset(); - } - - //Name of the being processed IE - void ie_name(const char* name) { m_errCtx.ie_name(name); } - char const* ie_name() const { return m_errCtx.ie_name(); } - -private: - template - friend struct Encode; - - error_context m_errCtx; - buf_type m_buffer; -}; - - -/******************************************************************************** -DecoderCtx -*********************************************************************************/ -class DecoderCtx : boost::noncopyable -{ -public: - typedef buffer buf_type; - typedef allocator alloc_type; - - DecoderCtx(const void* data = nullptr, size_t size = 0, void* alloc_buffer = nullptr, size_t alloc_buffer_size = 0) - : m_buffer{ m_errCtx } - { - reset(data, size, alloc_buffer, alloc_buffer_size); - } - - buf_type& refBuffer() { return m_buffer; } - alloc_type& refAllocator() { return m_allocator; } - error_context& refErrorCtx() { return m_errCtx; } - explicit operator bool() const { return static_cast(m_errCtx); } - - void reset(const void* data = nullptr, size_t size = 0, void* alloc_buffer = nullptr, size_t alloc_buffer_size = 0) - { - m_allocator.reset(alloc_buffer, alloc_buffer_size); - m_buffer.reset(static_cast(data), size); - m_errCtx.reset(); - } - - //Name of the being processed IE - void ie_name(const char* name) { m_errCtx.ie_name(name); } - char const* ie_name() const { return m_errCtx.ie_name(); } - -private: - error_context m_errCtx; - buf_type m_buffer; - alloc_type m_allocator; -}; - -} //namespace ber -} //namespace asn