X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fsrc%2Fbase%2Fe2sim.cpp;h=372cc9d9fd6b9f18556a23a7e1237c237aeecf42;hb=4b7683efa5ee46870e550ee6fa55f765a0a1f70c;hp=1f74389fd873478910c5e9ac8c7fd613338a8eda;hpb=a9733dbcc47e93a3b2843056f1d587196296c324;p=sim%2Fe2-interface.git diff --git a/e2sim/src/base/e2sim.cpp b/e2sim/src/base/e2sim.cpp index 1f74389..372cc9d 100644 --- a/e2sim/src/base/e2sim.cpp +++ b/e2sim/src/base/e2sim.cpp @@ -1,6 +1,7 @@ /***************************************************************************** # * # Copyright 2020 AT&T Intellectual Property * +# Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved. * # * # Licensed under the Apache License, Version 2.0 (the "License"); * # you may not use this file except in compliance with the License. * @@ -33,15 +34,25 @@ using namespace std; int client_fd = 0; +std::unordered_map E2Sim::getRegistered_ran_functions() { + return ran_functions_registered; +} + void E2Sim::register_subscription_callback(long func_id, SubscriptionCallback cb) { - printf("%%%%about to register callback for subscription for func_id %d\n", func_id); + fprintf(stderr,"%%%%about to register callback for subscription for func_id %d\n", func_id); subscription_callbacks[func_id] = cb; } SubscriptionCallback E2Sim::get_subscription_callback(long func_id) { - printf("%%%%we are getting the subscription callback for func id %d\n", func_id); - SubscriptionCallback cb = subscription_callbacks[func_id]; + fprintf(stderr, "%%%%we are getting the subscription callback for func id %d\n", func_id); + SubscriptionCallback cb; + + try { + cb = subscription_callbacks.at(func_id); + } catch(const std::out_of_range& e) { + throw std::out_of_range("Function ID is not registered"); + } return cb; }