class GMSEC::ConfigFile

Public Class Methods

new(filename) click to toggle source
# File lib/gmsec/config_file.rb, line 9
def initialize(filename)
  case
  when filename.nil?
    raise RuntimeError.new("Unable to create ConfigFile instance: filename not provided")
  when !File.exist?(filename.to_s)
    raise RuntimeError.new("Unable to create ConfigFile instance: '#{filename}' does not exist")
  end

  initialize_native_object do |pointer|
    gmsec_CreateConfigFile(pointer, filename, status)
  end

  gmsec_LoadConfigFile(self, status)

  if status.is_error?
    raise RuntimeError.new("Error reading config file: #{status}")
  end
end

Public Instance Methods

from_xml(str) click to toggle source
# File lib/gmsec/config_file.rb, line 34
def from_xml(str)
  gmsec_FromXMLConfigFile(self, str, status)
end
get_config(config_name) click to toggle source
# File lib/gmsec/config_file.rb, line 38
def get_config(config_name)
  GMSEC::Config.new.tap do |config|
    gmsec_LookupConfigFileConfig(self, config_name, config, status)
  end
end
get_message(message_name, message: GMSEC::Message.new) click to toggle source
# File lib/gmsec/config_file.rb, line 44
def get_message(message_name, message: GMSEC::Message.new)
  message.tap do |message|
    gmsec_LookupConfigFileMessage(self, message_name, message, status)
  end
end
get_subscription(subscription_name) click to toggle source
# File lib/gmsec/config_file.rb, line 50
def get_subscription(subscription_name)
  with_string_pointer do |pointer|
    gmsec_LookupConfigFileSubscription(self, subscription_name, pointer, status)
  end
end
to_xml() click to toggle source
# File lib/gmsec/config_file.rb, line 28
def to_xml
  with_string_pointer do |pointer|
    gmsec_ToXMLConfigFile(self, pointer, status)
  end
end