MIDAS
Loading...
Searching...
No Matches
midas_c_compat.cxx File Reference
#include "midas_c_compat.h"
#include "midas.h"
#include "mrpc.h"
#include "msystem.h"
#include <vector>
#include <string>
#include "string.h"
#include "stdlib.h"
#include "stdarg.h"
#include "history.h"
Include dependency graph for midas_c_compat.cxx:

Go to the source code of this file.

Functions

void c_free (void *mem)
 
void c_free_list (void **mem_list, int arr_len)
 
INT copy_string_to_c (std::string src, char *dest, DWORD dest_size)
 
template<class T >
INT copy_vector_to_c (std::vector< T > vec, void **dest, int &dest_len)
 
INT copy_vector_string_to_c (std::vector< std::string > vec, char ***dest, int &dest_len)
 
INT c_example_string_c_bufsize (char *buffer, DWORD buffer_size)
 
INT c_example_string_c_alloc (char **dest)
 
INT c_example_vector (void **dest, int &dest_len)
 
INT c_example_string_vector (char ***dest, int &dest_len)
 
INT c_al_trigger_alarm (const char *alarm_name, const char *alarm_message, const char *default_class, const char *cond_str, INT type)
 
INT c_al_reset_alarm (const char *alarm_name)
 
INT c_al_define_odb_alarm (const char *name, const char *condition, const char *aclass, const char *message)
 
INT c_bm_flush_cache (INT buffer_handle, INT async_flag)
 
INT c_bm_open_buffer (const char *buffer_name, INT buffer_size, INT *buffer_handle)
 
INT c_bm_receive_event (INT buffer_handle, void *destination, INT *buf_size, INT async_flag)
 
INT c_bm_remove_event_request (INT buffer_handle, INT request_id)
 
INT c_bm_request_event (INT buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, INT *request_id)
 
INT c_cm_check_deferred_transition (void)
 
INT c_cm_connect_client (const char *client_name, HNDLE *hConn)
 
INT c_cm_connect_experiment (const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
 
INT c_cm_deregister_transition (INT transition)
 
INT c_cm_disconnect_client (HNDLE hConn, BOOL bShutdown)
 
INT c_cm_disconnect_experiment ()
 
INT c_cm_exist (const char *name, BOOL bUnique)
 
INT c_cm_get_environment (char *host_name, int host_name_size, char *exp_name, int exp_name_size)
 
INT c_cm_get_experiment_database (HNDLE *hDB, HNDLE *hKeyClient)
 
INT c_cm_get_path (char *path, int path_size)
 
const charc_cm_get_revision (void)
 
const charc_cm_get_version (void)
 
INT c_cm_msg (INT message_type, const char *filename, INT line, const char *facility, const char *routine, const char *format,...)
 
INT c_cm_msg_facilities (char ***dest, int &dest_len)
 
INT c_cm_msg_register (EVENT_HANDLER *func)
 
INT c_cm_msg_retrieve2 (const char *facility, uint64_t before, INT min_messages, char **messages, int *num_messages_read)
 
INT c_cm_msg_open_buffer ()
 
INT c_cm_msg_close_buffer ()
 
INT c_cm_register_deferred_transition (INT transition, BOOL(*func)(INT, BOOL))
 
INT c_cm_register_function (INT id, INT(*func)(INT, void **))
 
INT c_cm_register_transition (INT transition, INT(*func)(INT, char *), int sequence_number)
 
INT c_cm_set_transition_sequence (INT transition, INT sequence_number)
 
INT c_cm_shutdown (const char *name, BOOL bUnique)
 
INT c_cm_start_watchdog_thread (void)
 
INT c_cm_stop_watchdog_thread (void)
 
INT c_cm_transition (INT transition, INT run_number, char *error, INT strsize, INT async_flag, INT debug_flag)
 
INT c_cm_yield (INT millisec)
 
INT c_db_close_record (HNDLE hdb, HNDLE hkey)
 
INT c_db_copy_json_ls (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
 
INT c_db_copy_json_save (HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
 
INT c_db_create_key (HNDLE hdb, HNDLE key_handle, const char *key_name, DWORD type)
 
INT c_db_create_link (HNDLE hdb, HNDLE key_handle, const char *link_name, const char *destination)
 
INT c_db_delete_key (HNDLE database_handle, HNDLE key_handle, BOOL follow_links)
 
INT c_db_enum_key (HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
 
INT c_db_enum_link (HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
 
INT c_db_find_key (HNDLE hdb, HNDLE hkey, const char *name, HNDLE *hsubkey)
 
INT c_db_find_link (HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
 
INT c_db_get_key (HNDLE hdb, HNDLE key_handle, KEY *key)
 
INT c_db_get_link_data (HNDLE hdb, HNDLE key_handle, void *data, INT *buf_size, DWORD type)
 
INT c_db_get_parent (HNDLE hDB, HNDLE hKey, HNDLE *parenthKey)
 
INT c_db_get_value (HNDLE hdb, HNDLE hKeyRoot, const char *key_name, void *data, INT *size, DWORD type, BOOL create)
 
INT c_db_open_record (HNDLE hdb, HNDLE hkey, void *ptr, INT rec_size, WORD access, void(*dispatcher)(INT, INT, void *), void *info)
 
INT c_db_rename_key (HNDLE hDB, HNDLE hKey, const char *name)
 
INT c_db_reorder_key (HNDLE hDB, HNDLE hKey, INT index)
 
INT c_db_resize_string (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, int num_values, int max_string_size)
 
INT c_db_set_link_data (HNDLE hdb, HNDLE key_handle, void *data, INT buf_size, int num_values, DWORD type)
 
INT c_db_set_num_values (HNDLE hDB, HNDLE hKey, INT num_values)
 
INT c_db_set_value (HNDLE hdb, HNDLE hKeyRoot, const char *key_name, const void *data, INT size, INT num_values, DWORD type)
 
INT c_db_set_value_index (HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT index, DWORD type, BOOL truncate)
 
INT c_db_unwatch (HNDLE hDB, HNDLE hKey)
 
INT c_db_watch (HNDLE hDB, HNDLE hKey, void(*dispatcher)(INT, INT, INT, void *), void *info)
 
INT c_jrpc_client_call (HNDLE hconn, char *cmd, char *args, char *buf, int buf_length)
 
INT c_brpc_client_call (HNDLE hconn, char *cmd, char *args, char *buf, int &buf_length)
 
INT c_rpc_flush_event (void)
 
INT c_rpc_is_remote (void)
 
INT c_rpc_send_event (INT buffer_handle, const EVENT_HEADER *event, INT buf_size, INT async_flag, INT mode)
 
INT c_ss_daemon_init (BOOL keep_stdout)
 
INT c_ss_exec (char *cmd, INT *child_pid)
 
INT c_connect_history_if_needed (HNDLE hDB, bool debug=false)
 
INT c_hs_get_events (HNDLE hDB, char ***dest, int &dest_len)
 
INT c_hs_get_tags (HNDLE hDB, char *event_name, char ***dest_names, void **dest_types, void **dest_n_data, int &dest_len)
 
INT c_hs_read (HNDLE hDB, uint32_t start_time, uint32_t end_time, uint32_t interval_secs, char *event_name, char *tag_name, int idx_start, int nvars, void **num_entries, void **times, void **values, void **hs_status)
 

Variables

MidasHistoryInterfacemh = nullptr
 

Function Documentation

◆ c_al_define_odb_alarm()

INT c_al_define_odb_alarm ( const char name,
const char condition,
const char aclass,
const char message 
)

Definition at line 179 of file midas_c_compat.cxx.

179 {
180 return al_define_odb_alarm(name, condition, aclass, message);
181}
INT EXPRT al_define_odb_alarm(const char *name, const char *condition, const char *aclass, const char *message)
Definition alarm.cxx:921
#define message(type, str)
#define name(x)
Definition midas_macro.h:24
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ c_al_reset_alarm()

INT c_al_reset_alarm ( const char alarm_name)

Definition at line 175 of file midas_c_compat.cxx.

175 {
177}
INT al_reset_alarm(const char *alarm_name)
Definition alarm.cxx:525
Here is the call graph for this function:

◆ c_al_trigger_alarm()

INT c_al_trigger_alarm ( const char alarm_name,
const char alarm_message,
const char default_class,
const char cond_str,
INT  type 
)

Definition at line 171 of file midas_c_compat.cxx.

171 {
172 return al_trigger_alarm(alarm_name, alarm_message, default_class, cond_str, type);
173}
INT al_trigger_alarm(const char *alarm_name, const char *alarm_message, const char *default_class, const char *cond_str, INT type)
Definition alarm.cxx:283
INT type
Definition mana.cxx:269
Here is the call graph for this function:

◆ c_bm_flush_cache()

INT c_bm_flush_cache ( INT  buffer_handle,
INT  async_flag 
)

Definition at line 183 of file midas_c_compat.cxx.

183 {
184 return bm_flush_cache(buffer_handle, async_flag);
185}
INT bm_flush_cache(int buffer_handle, int timeout_msec)
Definition midas.cxx:10207
Here is the call graph for this function:

◆ c_bm_open_buffer()

INT c_bm_open_buffer ( const char buffer_name,
INT  buffer_size,
INT buffer_handle 
)

Definition at line 187 of file midas_c_compat.cxx.

187 {
188 return bm_open_buffer(buffer_name, buffer_size, buffer_handle);
189}
INT bm_open_buffer(const char *buffer_name, INT buffer_size, INT *buffer_handle)
Definition midas.cxx:6717
char buffer_name[NAME_LENGTH]
Definition mevb.cxx:45
Here is the call graph for this function:

◆ c_bm_receive_event()

INT c_bm_receive_event ( INT  buffer_handle,
void destination,
INT buf_size,
INT  async_flag 
)

Definition at line 191 of file midas_c_compat.cxx.

191 {
192 return bm_receive_event(buffer_handle, destination, buf_size, async_flag);
193}
INT bm_receive_event(INT buffer_handle, void *destination, INT *buf_size, int timeout_msec)
Definition midas.cxx:10650
Here is the call graph for this function:

◆ c_bm_remove_event_request()

INT c_bm_remove_event_request ( INT  buffer_handle,
INT  request_id 
)

Definition at line 195 of file midas_c_compat.cxx.

195 {
196 return bm_remove_event_request(buffer_handle, request_id);
197}
INT bm_remove_event_request(INT buffer_handle, INT request_id)
Definition midas.cxx:8518
Here is the call graph for this function:

◆ c_bm_request_event()

INT c_bm_request_event ( INT  buffer_handle,
short int  event_id,
short int  trigger_mask,
INT  sampling_type,
INT request_id 
)

Definition at line 199 of file midas_c_compat.cxx.

199 {
200 // Final argument is function pointer that python lib doesn't need.
201 return bm_request_event(buffer_handle, event_id, trigger_mask, sampling_type, request_id, 0);
202}
INT bm_request_event(HNDLE buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, HNDLE *request_id, EVENT_HANDLER *func)
Definition midas.cxx:8465
#define trigger_mask
#define event_id
Here is the call graph for this function:

◆ c_brpc_client_call()

INT c_brpc_client_call ( HNDLE  hconn,
char cmd,
char args,
char buf,
int buf_length 
)

Definition at line 449 of file midas_c_compat.cxx.

449 {
450 // Specialized version of rpc_client_call that just deals with RPC_BRPC,
451 // so we don't have to worry about variable arg lists.
452 // You must already have malloc'd buf to be big enough for buf_length.
453 return rpc_client_call(hconn, RPC_BRPC, cmd, args, buf, &buf_length);
454}
#define RPC_BRPC
Definition mrpc.h:131
INT rpc_client_call(HNDLE hConn, DWORD routine_id,...)
Definition midas.cxx:13472
Here is the call graph for this function:

◆ c_cm_check_deferred_transition()

INT c_cm_check_deferred_transition ( void  )

Definition at line 204 of file midas_c_compat.cxx.

204 {
206}
INT cm_check_deferred_transition()
Definition midas.cxx:3889
Here is the call graph for this function:

◆ c_cm_connect_client()

INT c_cm_connect_client ( const char client_name,
HNDLE hConn 
)

Definition at line 208 of file midas_c_compat.cxx.

208 {
209 return cm_connect_client(client_name, hConn);
210}
INT cm_connect_client(const char *client_name, HNDLE *hConn)
Definition midas.cxx:2766
Here is the call graph for this function:

◆ c_cm_connect_experiment()

INT c_cm_connect_experiment ( const char host_name,
const char exp_name,
const char client_name,
void(*)(char *)  func 
)

Definition at line 212 of file midas_c_compat.cxx.

212 {
213 return cm_connect_experiment(host_name, exp_name, client_name, func);
214}
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
Definition midas.cxx:2278
char exp_name[NAME_LENGTH]
Definition mana.cxx:243
char host_name[HOST_NAME_LENGTH]
Definition mana.cxx:242
Here is the call graph for this function:

◆ c_cm_deregister_transition()

INT c_cm_deregister_transition ( INT  transition)

Definition at line 216 of file midas_c_compat.cxx.

216 {
218}
INT transition(INT run_number, char *error)
Definition consume.cxx:35
INT cm_deregister_transition(INT transition)
Definition midas.cxx:3669
Here is the call graph for this function:

◆ c_cm_disconnect_client()

INT c_cm_disconnect_client ( HNDLE  hConn,
BOOL  bShutdown 
)

Definition at line 220 of file midas_c_compat.cxx.

220 {
222}
INT cm_disconnect_client(HNDLE hConn, BOOL bShutdown)
Definition midas.cxx:2833
Here is the call graph for this function:

◆ c_cm_disconnect_experiment()

INT c_cm_disconnect_experiment ( )

Definition at line 224 of file midas_c_compat.cxx.

224 {
226}
INT cm_disconnect_experiment(void)
Definition midas.cxx:2846
Here is the call graph for this function:

◆ c_cm_exist()

INT c_cm_exist ( const char name,
BOOL  bUnique 
)

Definition at line 228 of file midas_c_compat.cxx.

228 {
229 return cm_exist(name, bUnique);
230}
INT cm_exist(const char *name, BOOL bUnique)
Definition midas.cxx:7520
Here is the call graph for this function:

◆ c_cm_get_environment()

INT c_cm_get_environment ( char host_name,
int  host_name_size,
char exp_name,
int  exp_name_size 
)

Definition at line 232 of file midas_c_compat.cxx.

232 {
234}
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
Definition midas.cxx:2134
Here is the call graph for this function:

◆ c_cm_get_experiment_database()

INT c_cm_get_experiment_database ( HNDLE hDB,
HNDLE hKeyClient 
)

Definition at line 236 of file midas_c_compat.cxx.

236 {
238}
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
Definition midas.cxx:3011
HNDLE hDB
main ODB handle
Definition mana.cxx:207
Here is the call graph for this function:

◆ c_cm_get_path()

INT c_cm_get_path ( char path,
int  path_size 
)

Definition at line 240 of file midas_c_compat.cxx.

240 {
241 std::string str_path = cm_get_path();
242 return copy_string_to_c(str_path, path, path_size);
243}
std::string cm_get_path()
Definition midas.cxx:1537
INT copy_string_to_c(std::string src, char *dest, DWORD dest_size)
Here is the call graph for this function:

◆ c_cm_get_revision()

const char * c_cm_get_revision ( void  )

Definition at line 245 of file midas_c_compat.cxx.

245 {
246 // If this changes to returning a string, do:
247 // return strdup(cm_get_revision().c_str());
248 return cm_get_revision();
249}
const char * cm_get_revision()
Definition midas.cxx:1484
Here is the call graph for this function:

◆ c_cm_get_version()

const char * c_cm_get_version ( void  )

Definition at line 251 of file midas_c_compat.cxx.

251 {
252 // If this changes to returning a string, do:
253 // return strdup(cm_get_version().c_str());
254 return cm_get_version();
255}
const char * cm_get_version()
Definition midas.cxx:1476
Here is the call graph for this function:

◆ c_cm_msg()

INT c_cm_msg ( INT  message_type,
const char filename,
INT  line,
const char facility,
const char routine,
const char format,
  ... 
)

Definition at line 257 of file midas_c_compat.cxx.

257 {
259 char message[1000];
260 va_start(argptr, format);
261 vsnprintf(message, 1000, (char *) format, argptr);
262 va_end(argptr);
263 return cm_msg1(message_type, filename, line, facility, routine, "%s", message);
264}
INT cm_msg1(INT message_type, const char *filename, INT line, const char *facility, const char *routine, const char *format,...)
Definition midas.cxx:973
Here is the call graph for this function:

◆ c_cm_msg_close_buffer()

INT c_cm_msg_close_buffer ( )

Definition at line 306 of file midas_c_compat.cxx.

306 {
307 return cm_msg_close_buffer();
308}
int cm_msg_close_buffer(void)
Definition midas.cxx:487
Here is the call graph for this function:

◆ c_cm_msg_facilities()

INT c_cm_msg_facilities ( char ***  dest,
int dest_len 
)

Definition at line 281 of file midas_c_compat.cxx.

281 {
282 std::vector<std::string> retvec;
284 if (retcode == SUCCESS) {
286 } else {
287 return retcode;
288 }
289}
#define SUCCESS
Definition mcstd.h:54
INT EXPRT cm_msg_facilities(STRING_LIST *list)
Definition midas.cxx:504
int INT
Definition midas.h:129
INT copy_vector_string_to_c(std::vector< std::string > vec, char ***dest, int &dest_len)
Here is the call graph for this function:

◆ c_cm_msg_open_buffer()

INT c_cm_msg_open_buffer ( )

Definition at line 302 of file midas_c_compat.cxx.

302 {
303 return cm_msg_open_buffer();
304}
int cm_msg_open_buffer(void)
Definition midas.cxx:474
Here is the call graph for this function:

◆ c_cm_msg_register()

INT c_cm_msg_register ( EVENT_HANDLER func)

Definition at line 291 of file midas_c_compat.cxx.

291 {
292 return cm_msg_register(func);
293}
INT cm_msg_register(EVENT_HANDLER *func)
Definition midas.cxx:1051
Here is the call graph for this function:

◆ c_cm_msg_retrieve2()

INT c_cm_msg_retrieve2 ( const char facility,
uint64_t  before,
INT  min_messages,
char **  messages,
int num_messages_read 
)

Definition at line 295 of file midas_c_compat.cxx.

295 {
296 // Python ctypes doesn't know the size of time_t, so just accept a uint64_t and convert here.
297 time_t t = before;
299 return retval;
300}
INT cm_msg_retrieve2(const char *facility, time_t t, INT n_message, char **messages, int *num_messages)
Definition midas.cxx:1264
Here is the call graph for this function:

◆ c_cm_register_deferred_transition()

INT c_cm_register_deferred_transition ( INT  transition,
BOOL(*)(INT, BOOL func 
)

Definition at line 310 of file midas_c_compat.cxx.

310 {
312}
INT cm_register_deferred_transition(INT transition, BOOL(*func)(INT, BOOL))
Definition midas.cxx:3837
Here is the call graph for this function:

◆ c_cm_register_function()

INT c_cm_register_function ( INT  id,
INT(*)(INT, void **)  func 
)

Definition at line 314 of file midas_c_compat.cxx.

314 {
315 return cm_register_function(id, func);
316}
INT cm_register_function(INT id, INT(*func)(INT, void **))
Definition midas.cxx:5790
Here is the call graph for this function:

◆ c_cm_register_transition()

INT c_cm_register_transition ( INT  transition,
INT(*)(INT, char *)  func,
int  sequence_number 
)

Definition at line 318 of file midas_c_compat.cxx.

318 {
319 return cm_register_transition(transition, func, sequence_number);
320}
INT cm_register_transition(INT transition, INT(*func)(INT, char *), INT sequence_number)
Definition midas.cxx:3593
Here is the call graph for this function:

◆ c_cm_set_transition_sequence()

INT c_cm_set_transition_sequence ( INT  transition,
INT  sequence_number 
)

Definition at line 322 of file midas_c_compat.cxx.

322 {
323 return cm_set_transition_sequence(transition, sequence_number);
324}
INT cm_set_transition_sequence(INT transition, INT sequence_number)
Definition midas.cxx:3723
Here is the call graph for this function:

◆ c_cm_shutdown()

INT c_cm_shutdown ( const char name,
BOOL  bUnique 
)

Definition at line 326 of file midas_c_compat.cxx.

326 {
327 return cm_shutdown(name, bUnique);
328}
INT cm_shutdown(const char *name, BOOL bUnique)
Definition midas.cxx:7400
Here is the call graph for this function:

◆ c_cm_start_watchdog_thread()

INT c_cm_start_watchdog_thread ( void  )

Definition at line 330 of file midas_c_compat.cxx.

330 {
332}
INT cm_start_watchdog_thread()
Definition midas.cxx:7355
Here is the call graph for this function:

◆ c_cm_stop_watchdog_thread()

INT c_cm_stop_watchdog_thread ( void  )

Definition at line 334 of file midas_c_compat.cxx.

334 {
336}
INT cm_stop_watchdog_thread()
Definition midas.cxx:7370
Here is the call graph for this function:

◆ c_cm_transition()

INT c_cm_transition ( INT  transition,
INT  run_number,
char error,
INT  strsize,
INT  async_flag,
INT  debug_flag 
)

Definition at line 338 of file midas_c_compat.cxx.

338 {
339 return cm_transition(transition, run_number, error, strsize, async_flag, debug_flag);
340}
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
Definition midas.cxx:5286
INT run_number[2]
Definition mana.cxx:246
Here is the call graph for this function:

◆ c_cm_yield()

INT c_cm_yield ( INT  millisec)

Definition at line 342 of file midas_c_compat.cxx.

342 {
343 return cm_yield(millisec);
344}
INT cm_yield(INT millisec)
Definition midas.cxx:5642
Here is the call graph for this function:

◆ c_connect_history_if_needed()

INT c_connect_history_if_needed ( HNDLE  hDB,
bool  debug = false 
)

Definition at line 478 of file midas_c_compat.cxx.

478 {
480
481 if (mh == nullptr) {
483 }
484
485 return status;
486}
#define HS_GET_DEFAULT
Definition history.h:38
#define HS_GET_INACTIVE
Definition history.h:37
#define HS_GET_READER
Definition history.h:35
int hs_get_history(HNDLE hDB, HNDLE hKey, int flags, int debug_flag, MidasHistoryInterface **mh)
BOOL debug
debug printouts
Definition mana.cxx:254
MidasHistoryInterface * mh
DWORD status
Definition odbhist.cxx:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_db_close_record()

INT c_db_close_record ( HNDLE  hdb,
HNDLE  hkey 
)

Definition at line 346 of file midas_c_compat.cxx.

346 {
347 return db_close_record(hdb, hkey);
348}
INT db_close_record(HNDLE hDB, HNDLE hKey)
Definition odb.cxx:13473
HNDLE hdb
Definition midas_macro.h:21
Here is the call graph for this function:

◆ c_db_copy_json_ls()

INT c_db_copy_json_ls ( HNDLE  hDB,
HNDLE  hKey,
char **  buffer,
int buffer_size,
int buffer_end 
)

Definition at line 350 of file midas_c_compat.cxx.

350 {
351 return db_copy_json_ls(hDB, hKey, buffer, buffer_size, buffer_end);
352}
INT db_copy_json_ls(HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
Definition odb.cxx:10421
HNDLE hKey
Here is the call graph for this function:

◆ c_db_copy_json_save()

INT c_db_copy_json_save ( HNDLE  hDB,
HNDLE  hKey,
char **  buffer,
int buffer_size,
int buffer_end 
)

Definition at line 354 of file midas_c_compat.cxx.

354 {
355 return db_copy_json_save(hDB, hKey, buffer, buffer_size, buffer_end);
356}
INT db_copy_json_save(HNDLE hDB, HNDLE hKey, char **buffer, int *buffer_size, int *buffer_end)
Definition odb.cxx:10475
Here is the call graph for this function:

◆ c_db_create_key()

INT c_db_create_key ( HNDLE  hdb,
HNDLE  key_handle,
const char key_name,
DWORD  type 
)

Definition at line 358 of file midas_c_compat.cxx.

358 {
359 return db_create_key(hdb, key_handle, key_name, type);
360}
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
Definition odb.cxx:3308
Here is the call graph for this function:

◆ c_db_create_link()

INT c_db_create_link ( HNDLE  hdb,
HNDLE  key_handle,
const char link_name,
const char destination 
)

Definition at line 362 of file midas_c_compat.cxx.

362 {
364}
INT db_create_link(HNDLE hDB, HNDLE hKey, const char *link_name, const char *destination)
Definition odb.cxx:3601
Here is the call graph for this function:

◆ c_db_delete_key()

INT c_db_delete_key ( HNDLE  database_handle,
HNDLE  key_handle,
BOOL  follow_links 
)

Definition at line 366 of file midas_c_compat.cxx.

366 {
368}
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
Definition odb.cxx:3856
Here is the call graph for this function:

◆ c_db_enum_key()

INT c_db_enum_key ( HNDLE  hDB,
HNDLE  hKey,
INT  idx,
HNDLE subkey_handle 
)

Definition at line 370 of file midas_c_compat.cxx.

370 {
372}
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5586
Here is the call graph for this function:

◆ c_db_enum_link()

INT c_db_enum_link ( HNDLE  hDB,
HNDLE  hKey,
INT  idx,
HNDLE subkey_handle 
)

Definition at line 374 of file midas_c_compat.cxx.

374 {
376}
INT db_enum_link(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5725
Here is the call graph for this function:

◆ c_db_find_key()

INT c_db_find_key ( HNDLE  hdb,
HNDLE  hkey,
const char name,
HNDLE hsubkey 
)

Definition at line 378 of file midas_c_compat.cxx.

378 {
379 return db_find_key(hdb, hkey, name, hsubkey);
380}
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
Here is the call graph for this function:

◆ c_db_find_link()

INT c_db_find_link ( HNDLE  hDB,
HNDLE  hKey,
const char key_name,
HNDLE subhKey 
)

Definition at line 382 of file midas_c_compat.cxx.

382 {
383 return db_find_link(hDB, hKey, key_name, subhKey);
384}
INT db_find_link(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4274
Here is the call graph for this function:

◆ c_db_get_key()

INT c_db_get_key ( HNDLE  hdb,
HNDLE  key_handle,
KEY key 
)

Definition at line 386 of file midas_c_compat.cxx.

386 {
387 return db_get_key(hdb, key_handle, key);
388}
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6019
KEY key
Definition mdump.cxx:34
Here is the call graph for this function:

◆ c_db_get_link_data()

INT c_db_get_link_data ( HNDLE  hdb,
HNDLE  key_handle,
void data,
INT buf_size,
DWORD  type 
)

Definition at line 390 of file midas_c_compat.cxx.

390 {
391 return db_get_link_data(hdb, key_handle, data, buf_size, type);
392}
INT db_get_link_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
Definition odb.cxx:6656
void * data
Definition mana.cxx:268
Here is the call graph for this function:

◆ c_db_get_parent()

INT c_db_get_parent ( HNDLE  hDB,
HNDLE  hKey,
HNDLE parenthKey 
)

Definition at line 394 of file midas_c_compat.cxx.

394 {
396}
static const KEY * db_get_parent(const DATABASE_HEADER *pheader, const KEY *pkey, int *pstatus, const char *caller, db_err_msg **msg)
Definition odb.cxx:1030
Here is the call graph for this function:

◆ c_db_get_value()

INT c_db_get_value ( HNDLE  hdb,
HNDLE  hKeyRoot,
const char key_name,
void data,
INT size,
DWORD  type,
BOOL  create 
)

Definition at line 398 of file midas_c_compat.cxx.

398 {
399 return db_get_value(hdb, hKeyRoot, key_name, data, size, type, create);
400}
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
Definition odb.cxx:5415
BOOL create
Definition mchart.cxx:39
Here is the call graph for this function:

◆ c_db_open_record()

INT c_db_open_record ( HNDLE  hdb,
HNDLE  hkey,
void ptr,
INT  rec_size,
WORD  access,
void(*)(INT, INT, void *)  dispatcher,
void info 
)

Definition at line 402 of file midas_c_compat.cxx.

402 {
403 return db_open_record(hdb, hkey, ptr, rec_size, access, dispatcher, info);
404}
INT db_open_record(HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info)
Definition odb.cxx:13291
void ** info
Definition fesimdaq.cxx:41
Here is the call graph for this function:

◆ c_db_rename_key()

INT c_db_rename_key ( HNDLE  hDB,
HNDLE  hKey,
const char name 
)

Definition at line 406 of file midas_c_compat.cxx.

406 {
407 return db_rename_key(hDB, hKey, name);
408}
INT db_rename_key(HNDLE hDB, HNDLE hKey, const char *name)
Definition odb.cxx:6261
Here is the call graph for this function:

◆ c_db_reorder_key()

INT c_db_reorder_key ( HNDLE  hDB,
HNDLE  hKey,
INT  index 
)

Definition at line 410 of file midas_c_compat.cxx.

410 {
411 return db_reorder_key(hDB, hKey, index);
412}
INT db_reorder_key(HNDLE hDB, HNDLE hKey, INT idx)
Definition odb.cxx:6361
INT index
Definition mana.cxx:271
Here is the call graph for this function:

◆ c_db_resize_string()

INT c_db_resize_string ( HNDLE  hDB,
HNDLE  hKeyRoot,
const char key_name,
int  num_values,
int  max_string_size 
)

Definition at line 414 of file midas_c_compat.cxx.

414 {
415 return db_resize_string(hDB, hKeyRoot, key_name, num_values, max_string_size);
416}
INT EXPRT db_resize_string(HNDLE hdb, HNDLE hKeyRoot, const char *key_name, int num_values, int max_string_length)
Definition odb.cxx:14025
Here is the call graph for this function:

◆ c_db_set_link_data()

INT c_db_set_link_data ( HNDLE  hdb,
HNDLE  key_handle,
void data,
INT  buf_size,
int  num_values,
DWORD  type 
)

Definition at line 418 of file midas_c_compat.cxx.

418 {
419 return db_set_link_data(hdb, key_handle, data, buf_size, num_values, type);
420}
INT db_set_link_data(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
Definition odb.cxx:7425
Here is the call graph for this function:

◆ c_db_set_num_values()

INT c_db_set_num_values ( HNDLE  hDB,
HNDLE  hKey,
INT  num_values 
)

Definition at line 422 of file midas_c_compat.cxx.

422 {
423 return db_set_num_values(hDB, hKey, num_values);
424}
INT db_set_num_values(HNDLE hDB, HNDLE hKey, INT num_values)
Definition odb.cxx:7502
Here is the call graph for this function:

◆ c_db_set_value()

INT c_db_set_value ( HNDLE  hdb,
HNDLE  hKeyRoot,
const char key_name,
const void data,
INT  size,
INT  num_values,
DWORD  type 
)

Definition at line 426 of file midas_c_compat.cxx.

426 {
427 return db_set_value(hdb, hKeyRoot, key_name, data, size, num_values, type);
428}
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
Definition odb.cxx:5261
Here is the call graph for this function:

◆ c_db_set_value_index()

INT c_db_set_value_index ( HNDLE  hDB,
HNDLE  hKeyRoot,
const char key_name,
const void data,
INT  data_size,
INT  index,
DWORD  type,
BOOL  truncate 
)

Definition at line 430 of file midas_c_compat.cxx.

430 {
431 return db_set_value_index(hDB, hKeyRoot, key_name, data, data_size, index, type, truncate);
432}
INT db_set_value_index(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT idx, DWORD type, BOOL trunc)
Definition odb.cxx:5365
Here is the call graph for this function:

◆ c_db_unwatch()

INT c_db_unwatch ( HNDLE  hDB,
HNDLE  hKey 
)

Definition at line 434 of file midas_c_compat.cxx.

434 {
435 return db_unwatch(hDB, hKey);
436}
INT db_unwatch(HNDLE hDB, HNDLE hKey)
Definition odb.cxx:13887
Here is the call graph for this function:

◆ c_db_watch()

INT c_db_watch ( HNDLE  hDB,
HNDLE  hKey,
void(*)(INT, INT, INT, void *)  dispatcher,
void info 
)

Definition at line 438 of file midas_c_compat.cxx.

438 {
439 return db_watch(hDB, hKey, dispatcher, info);
440}
INT db_watch(HNDLE hDB, HNDLE hKey, void(*dispatcher)(INT, INT, INT, void *), void *info)
Definition odb.cxx:13813
Here is the call graph for this function:

◆ c_example_string_c_alloc()

INT c_example_string_c_alloc ( char **  dest)

Definition at line 107 of file midas_c_compat.cxx.

107 {
108 std::string retval("My string that would come from a C++ function");
109 *dest = strdup(retval.c_str());
110 return SUCCESS;
111}
Here is the call graph for this function:

◆ c_example_string_c_bufsize()

INT c_example_string_c_bufsize ( char buffer,
DWORD  buffer_size 
)

Definition at line 89 of file midas_c_compat.cxx.

89 {
90 std::string retval("My string that would come from a C++ function");
91 return copy_string_to_c(retval, buffer, buffer_size);
92}
Here is the call graph for this function:

◆ c_example_string_vector()

INT c_example_string_vector ( char ***  dest,
int dest_len 
)

Definition at line 163 of file midas_c_compat.cxx.

163 {
164 std::vector<std::string> retvec;
165 retvec.push_back("Hello");
166 retvec.push_back("world!");
167
169}
Here is the call graph for this function:

◆ c_example_vector()

INT c_example_vector ( void **  dest,
int dest_len 
)

Definition at line 134 of file midas_c_compat.cxx.

134 {
135 std::vector<float> retvec;
136 for (int i = 0; i < 10; i++) {
137 retvec.push_back(i/3.);
138 }
139
141}
INT i
Definition mdump.cxx:32
INT copy_vector_to_c(std::vector< T > vec, void **dest, int &dest_len)
Here is the call graph for this function:

◆ c_free()

void c_free ( void mem)

Definition at line 18 of file midas_c_compat.cxx.

18 {
19 free(mem);
20}
Here is the call graph for this function:

◆ c_free_list()

void c_free_list ( void **  mem_list,
int  arr_len 
)

Definition at line 22 of file midas_c_compat.cxx.

22 {
23 for (int i = 0; i < arr_len; i++) {
24 free(mem_list[i]);
25 }
26
27 free(mem_list);
28}
Here is the call graph for this function:

◆ c_hs_get_events()

INT c_hs_get_events ( HNDLE  hDB,
char ***  dest,
int dest_len 
)

Definition at line 488 of file midas_c_compat.cxx.

488 {
490
491 if (status != SUCCESS) {
492 return status;
493 }
494
495 time_t t = 0;
496 std::vector<std::string> events;
497
499
500 if (status != SUCCESS) {
501 return status;
502 }
503
505}
virtual int hs_get_events(time_t time_from, std::vector< std::string > *pevents)=0
get list of events that exist(ed) at given time and later (value 0 means "return all events from begi...
INT c_connect_history_if_needed(HNDLE hDB, bool debug=false)
Here is the call graph for this function:

◆ c_hs_get_tags()

INT c_hs_get_tags ( HNDLE  hDB,
char event_name,
char ***  dest_names,
void **  dest_types,
void **  dest_n_data,
int dest_len 
)

Definition at line 507 of file midas_c_compat.cxx.

507 {
509
510 if (status != SUCCESS) {
511 return status;
512 }
513
514 time_t t = 0;
515 std::vector<TAG> tags;
516 status = mh->hs_get_tags(event_name, t, &tags);
517
518 if (status != SUCCESS) {
519 return status;
520 }
521
522 std::vector<std::string> tag_names;
523 std::vector<DWORD> tag_types;
524 std::vector<DWORD> tag_n_data;
525
526 for (auto& tag : tags) {
527 tag_names.push_back(tag.name);
528 tag_types.push_back(tag.type);
529 tag_n_data.push_back(tag.n_data);
530 }
531
535 return SUCCESS;
536}
virtual int hs_get_tags(const char *event_name, time_t time_from, std::vector< TAG > *ptags)=0
get list of history variables for given event (use event names returned by hs_get_events()) that exis...
Here is the call graph for this function:

◆ c_hs_read()

INT c_hs_read ( HNDLE  hDB,
uint32_t  start_time,
uint32_t  end_time,
uint32_t  interval_secs,
char event_name,
char tag_name,
int  idx_start,
int  nvars,
void **  num_entries,
void **  times,
void **  values,
void **  hs_status 
)

Definition at line 538 of file midas_c_compat.cxx.

541 {
542 // Note this function varies from hs_read() for the times/tbuffer and values/vbuffer
543 // parameters! To simplify passing between python/C, we concatenate all the data for
544 // all variables into one array, rather than using a 2D array.
545 // So num_entries and hs_status are length "nvars", while
546 // times and values are length "sum of num_entries".
548
549 if (status != SUCCESS) {
550 return status;
551 }
552
553 const char** event_names = (const char**)calloc(nvars, sizeof(const char*));
554 const char** var_names = (const char**)calloc(nvars, sizeof(const char*));
555 int* indices = (int*)calloc(nvars, sizeof(int));
556
557 for (int i = 0; i < nvars; i++) {
558 event_names[i] = event_name;
559 var_names[i] = tag_name;
560 indices[i] = idx_start + i;
561 }
562
563 *num_entries = calloc(nvars, sizeof(int));
564 time_t** tbuffer_int = (time_t**)calloc(nvars, sizeof(time_t*));
565 double** vbuffer_int = (double**)calloc(nvars, sizeof(double*));
566 *hs_status = calloc(nvars, sizeof(int));
567
568 status = mh->hs_read(start_time, end_time, interval_secs, nvars, event_names, var_names, indices, (int*)*num_entries, tbuffer_int, vbuffer_int, (int*)*hs_status);
569
570 // Simplify passing back to python by concatenating timestamp buffers into
571 // a single buffer rather than 2-D array. Same for value buffers.
572 size_t tot_len = 0;
573
574 for (int i = 0; i < nvars; i++) {
575 tot_len += ((int*)(*num_entries))[i];
576 }
577
578 if (tot_len > 0) {
579 *times = calloc(tot_len, sizeof(uint32_t));
580 *values = calloc(tot_len, sizeof(double));
581
583 double* cast_vbuffer = (double*)*values;
584 size_t offset = 0;
585
586 for (int i = 0; i < nvars; i++) {
587 size_t this_n = ((int*)(*num_entries))[i];
588 for (int n = 0; n < (int) this_n; n++) {
589 // Deal with time_t vs uint32_t possibly being different sizes
590 // by manually copying values rather than doing a memcpy.
593 }
594
595 offset += this_n;
596 }
597 }
598
599 free(tbuffer_int);
600 free(vbuffer_int);
601 free(event_names);
602 free(var_names);
603 free(indices);
604
605 return status;
606}
virtual int hs_read(time_t start_time, time_t end_time, time_t interval, int num_var, const char *const event_name[], const char *const tag_name[], const int var_index[], int num_entries[], time_t *time_buffer[], double *data_buffer[], int status[])=0
see hs_read(), returns HS_SUCCESS
DWORD n[4]
Definition mana.cxx:247
static int offset
Definition mgd.cxx:1500
Here is the call graph for this function:

◆ c_jrpc_client_call()

INT c_jrpc_client_call ( HNDLE  hconn,
char cmd,
char args,
char buf,
int  buf_length 
)

Definition at line 442 of file midas_c_compat.cxx.

442 {
443 // Specialized version of rpc_client_call that just deals with RPC_JRPC,
444 // so we don't have to worry about variable arg lists.
445 // You must already have malloc'd buf to be big enough for buf_length.
446 return rpc_client_call(hconn, RPC_JRPC, cmd, args, buf, buf_length);
447}
#define RPC_JRPC
Definition mrpc.h:130
Here is the call graph for this function:

◆ c_rpc_flush_event()

INT c_rpc_flush_event ( void  )

Definition at line 456 of file midas_c_compat.cxx.

456 {
457 return rpc_flush_event();
458}
INT rpc_flush_event()
Definition midas.cxx:14038
Here is the call graph for this function:

◆ c_rpc_is_remote()

INT c_rpc_is_remote ( void  )

Definition at line 460 of file midas_c_compat.cxx.

460 {
461 return rpc_is_remote();
462}
bool rpc_is_remote(void)
Definition midas.cxx:12761
Here is the call graph for this function:

◆ c_rpc_send_event()

INT c_rpc_send_event ( INT  buffer_handle,
const EVENT_HEADER event,
INT  buf_size,
INT  async_flag,
INT  mode 
)

Definition at line 464 of file midas_c_compat.cxx.

464 {
465 return rpc_send_event(buffer_handle, event, buf_size, async_flag, mode);
466}
INT rpc_send_event(INT buffer_handle, const EVENT_HEADER *pevent, int unused, INT async_flag, INT mode)
Definition midas.cxx:13901
Here is the call graph for this function:

◆ c_ss_daemon_init()

INT c_ss_daemon_init ( BOOL  keep_stdout)

Definition at line 468 of file midas_c_compat.cxx.

468 {
470}
INT ss_daemon_init(BOOL keep_stdout)
Definition system.cxx:2001
Here is the call graph for this function:

◆ c_ss_exec()

INT c_ss_exec ( char cmd,
INT child_pid 
)

Definition at line 472 of file midas_c_compat.cxx.

472 {
473 return ss_exec(cmd, child_pid);
474}
INT ss_exec(const char *command, INT *pid)
Definition system.cxx:2132
Here is the call graph for this function:

◆ copy_string_to_c()

INT copy_string_to_c ( std::string  src,
char dest,
DWORD  dest_size 
)

Definition at line 40 of file midas_c_compat.cxx.

40 {
41 strncpy(dest, src.c_str(), dest_size);
42
43 if (src.size() > dest_size) {
44 return DB_TRUNCATED;
45 }
46
47 return SUCCESS;
48}
#define DB_TRUNCATED
Definition midas.h:644
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_vector_string_to_c()

INT copy_vector_string_to_c ( std::vector< std::string >  vec,
char ***  dest,
int dest_len 
)

Definition at line 67 of file midas_c_compat.cxx.

67 {
68 dest_len = vec.size();
69 *dest = (char**) malloc(sizeof(char*) * dest_len);
70
71 for (int i = 0; i < dest_len; i++) {
72 (*dest)[i] = strdup(vec[i].c_str());
73 }
74
75 return SUCCESS;
76}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_vector_to_c()

template<class T >
INT copy_vector_to_c ( std::vector< T >  vec,
void **  dest,
int dest_len 
)

Definition at line 55 of file midas_c_compat.cxx.

55 {
56 dest_len = vec.size();
57 *dest = malloc(sizeof(T) * dest_len);
58 std::copy(vec.begin(), vec.end(), (T*)*dest);
59 return SUCCESS;
60}
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ mh

Definition at line 476 of file midas_c_compat.cxx.