OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimInit.cpp
Go to the documentation of this file.
1 //*****************************************************************************
2 // FILE: ossimInit.cpp
3 //
4 // License: MIT
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // DESCRIPTION:
9 // Contains implementation of class ossimInit. This object handles all
10 // aspects of initialization for OSSIM applications. These tasks include:
11 //
12 // 1. Parsing the command line.
13 // 2. Instantiating all class factories.
14 // 3. Initializing the "trace" code execution tracing functionality.
15 // 4. Scanning the preferences file for relevant values.
16 //
17 // SOFTWARE HISTORY:
18 // 24Apr2001 Oscar Kramer
19 // Initial coding.
20 //*****************************************************************************
21 // $Id$
22 
23 #include <ossim/init/ossimInit.h>
24 #include <ossim/ossimVersion.h>
25 
34 #include <ossim/base/ossimNotify.h>
38 #include <ossim/base/ossimTrace.h>
42 
43 
45 
47 
50 
59 
62 
65 
66 #include <algorithm>
67 #include <mutex>
68 
69 static ossimTrace traceExec = ossimTrace("ossimInit:exec");
70 static ossimTrace traceDebug = ossimTrace("ossimInit:debug");
71 
73 
75 {
76  theInstance = 0;
77 }
78 
80  :
81  theInitializedFlag(false),
82  theAppName(),
83  thePreferences(0), // Delay instance() call until stream factory init.
84  theElevEnabledFlag(true),
85  thePluginLoaderEnabledFlag(true)
86 {
87 }
88 
90 {
91  static std::mutex m;
92  std::lock_guard<std::mutex> lock(m);
93  if (!theInstance)
94  {
95  theInstance = new ossimInit();
96  }
97  return theInstance;
98 }
99 
101 {
102  parser.getApplicationUsage()->addCommandLineOption("--env", "Specify an env variable to set. Any number of these can appear with format --env VARIABLE=VALUE");
103  parser.getApplicationUsage()->addCommandLineOption("-P", "specify a preference file to load");
104  parser.getApplicationUsage()->addCommandLineOption("-K", "specify individual keywords to add to the preferences keyword list: name=value");
105  parser.getApplicationUsage()->addCommandLineOption("-T", "specify the classes to trace, ex: ossimInit|ossimImage.* \nwill trace ossimInit and all ossimImage classes");
106  parser.getApplicationUsage()->addCommandLineOption("--disable-elev", "Will disable the elevation");
107  parser.getApplicationUsage()->addCommandLineOption("--disable-plugin", "Will disable the plugin loader");
108 
109  parser.getApplicationUsage()->addCommandLineOption("--ossim-logfile", "takes a logfile as an argument. All output messages are redirected to the specified log file. By default there is no log file and all messages are enabled.");
110  parser.getApplicationUsage()->addCommandLineOption("--disable-notify", "Takes an argument. Arguments are ALL, WARN, NOTICE, INFO, FATAL, DEBUG. If you want multiple disables then just do multiple --disable-notify on the command line. All argument are case insensitive. Default is all are enabled.");
111 }
112 
113 /*!****************************************************************************
114  * METHOD: ossimInit::initialize()
115  *
116  * Method called from the OSSIM application main.
117  *
118  *****************************************************************************/
119 void ossimInit::initialize(int& argc, char** argv)
120 {
121  static std::mutex m;
122  std::lock_guard<std::mutex> lock(m);
123  if( !theInitializedFlag )
124  {
125  ossimArgumentParser argumentParser(&argc, argv);
126  theInstance->initialize(argumentParser);
127  }
128 }
129 
131 {
132  static std::mutex m;
133  std::lock_guard<std::mutex> lock(m);
135  {
136  if (traceDebug())
137  {
139  << "DEBUG ossimInit::initialize(parser):"
140  << " Already initialized, returning......"
141  << std::endl;
142  }
143  return;
144  }
145  theInstance->parseEnvOptions(parser);
148 
150 
151  //Parse the command line:
152 
153  theInstance->parseOptions(parser);
154  // we will also support defining a trace pattern from an Environment
155  // variable. This will make JNI code easier to enable tracing
156  //
157  ossimString traceVariable = ossimEnvironmentUtility::instance()->getEnvironmentVariable("OSSIM_TRACE");
158 
159  if(!traceVariable.empty())
160  {
162  }
163 
165 
166  if ( theElevEnabledFlag )
167  {
169  }
170 
172 
174  {
176  }
177 
178  if (traceDebug())
179  {
181  << "ossim preferences file: "
183  << "\nVersion: " << version()
184  << "\nossimInit::initialize(parser): leaving..." << std::endl;
185  }
186 
187  theInitializedFlag = true;
188 }
189 
191 {
193  {
194  if (traceDebug())
195  {
197  << "DEBUG ossimInit::initialize(parser):"
198  << " Already initialized, returning......"
199  << std::endl;
200  }
201  return;
202  }
203 
204  int argc = 1;
205  char* argv[1];
206 
207  argv[0] = new char[1];
208  argv[0][0] = '\0';
209  initialize(argc, argv);
210  delete [] argv[0];
211 
212 #if 0
213  static std::mutex m;
214  std::lock_guard<std::mutex> lock(m);
216  {
217  if (traceDebug())
218  {
220  << "DEBUG ossimInit::initialize(): Already initialized, returning......" << std::endl;
221  }
222  return;
223  }
224 
225  theInstance->theAppName = "";
228 
229  if ( theElevEnabledFlag )
230  {
232  }
233 
235 
236  //---
237  // To do:
238  // We need a mechanism to register factories to the "front" or the
239  // "back" of factory list so that plugins can override things. For
240  // now we will initialize the plugins last...
241  //---
243  {
245  }
246 
247  if (traceDebug())
248  {
250  << "ossim preferences file: "
252  << "\nVersion: " << version()
253  << "\nossimInit::initialize() leaving..."
254  << std::endl;
255  }
256 
257  theInitializedFlag = true;
258 #endif
259 }
260 
262 {
263 
264 }
265 /*!****************************************************************************
266  * Prints to stdout the list of command line options that this object parses.
267  *****************************************************************************/
269 {
271  << "INFORMATION ossimInit::usage():\n"
272  << "Additional command-line options available are as follows: "
273  << "\n"
274  << "\n -P<pref_filename> -- Allows the user to override the loading "
275  << "\n of the default preferences with their own pref file."
276  << "\n"
277  << "\n -K<keyword>[=<value>] -- Allows the user to specify additional"
278  << "\n keyword/value pairs that are added onto the preferences "
279  << "\n previously loaded. Keywords specified here override those in"
280  << "\n the preferences file."
281  << "\n"
282  << "\n -T<trace_tag> -- Lets user turn on specific trace flags."
283  << "\n"
284  << "\n -S<session_filename> -- Allows user to specify a session file"
285  << "\n to load."
286  << std::endl;
287  return;
288 }
289 
291 {
292  return theElevEnabledFlag;
293 }
294 
296 {
297  theElevEnabledFlag = flag;
298 }
299 
301 {
303 }
304 
305 void ossimInit::loadPlugins(const ossimFilename& plugin, const char* options)
306 {
307  if(!thePluginLoaderEnabledFlag) return;
308 
309  if(plugin.exists())
310  {
311  if(plugin.isDir())
312  {
313  ossimDirectory dir;
314  if(dir.open(plugin))
315  {
316  ossimFilename file;
317 
319  {
320  do
321  {
323  }
324  while(dir.getNext(file));
325  }
326  }
327  }
328  else
329  {
331  }
332  }
333 }
334 
336 {
337  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
338  << "DEBUG ossimInit::parseOptions: entering..." << std::endl;
339 
340 
341  std::string tempString;
342  ossimArgumentParser::ossimParameter stringParameter(tempString);
343 
344  tempString = "";
345  ossimString prefsFile = ossimEnvironmentUtility::instance()->getEnvironmentVariable("OSSIM_PREFS_FILE");
347  if(!prefsFile.empty())
348  {
349  thePreferences->loadPreferences();// Use the default load
350  }
351  tempString = "";
352  // override ENV with passed in variable
353  while(parser.read("-P", stringParameter));
354 
355  if(tempString != "")
356  {
358  }
359  tempString = "";
360  while(parser.read("-K", stringParameter))
361  {
362  ossimString option = tempString;
363  if (option.contains("=") )
364  {
365  ossimString delimiter = "=";
366  ossimString key (option.before(delimiter));
367  ossimString value = option.after(delimiter);
368  thePreferences->addPreference(key.c_str(), value.c_str());
369  }
370  else
371  {
372  ossimString key (option);
373  thePreferences->addPreference(key, "");
374  }
375  }
376 
377 }
378 
380 {
381  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
382  << "DEBUG ossimInit::parseOptions: entering..." << std::endl;
383 
384  std::string tempString;
385  ossimArgumentParser::ossimParameter stringParameter(tempString);
386 
387  tempString = "";
388 
389  while(parser.read("-T", stringParameter))
390  {
392  }
393 
394  while(parser.read("--ossim-logfile", stringParameter))
395  {
396  ossimSetLogFilename(ossimFilename(tempString));
397  }
398  while(parser.read("--disable-notify", stringParameter))
399  {
400  ossimString tempDownCase = tempString;
401  tempDownCase = tempDownCase.downcase();
402 
403  if(tempDownCase == "warn")
404  {
406  }
407  else if(tempDownCase == "fatal")
408  {
410  }
411  else if(tempDownCase == "debug")
412  {
414  }
415  else if(tempDownCase == "info")
416  {
418  }
419  else if(tempDownCase == "notice")
420  {
422  }
423  else if(tempDownCase == "all")
424  {
426  }
427  }
428  if(parser.read("--disable-elev"))
429  {
430  theElevEnabledFlag = false;
431  }
432  if(parser.read("--disable-plugin"))
433  {
435  }
436 }
437 
439 {
440  std::string tempString;
441  ossimArgumentParser::ossimParameter stringParameter(tempString);
442  while(parser.read("--disable-notify", stringParameter))
443  {
444  ossimString tempDownCase = tempString;
445  tempDownCase = tempDownCase.downcase();
446 
447  if(tempDownCase == "warn")
448  {
450  }
451  else if(tempDownCase == "fatal")
452  {
454  }
455  else if(tempDownCase == "debug")
456  {
458  }
459  else if(tempDownCase == "info")
460  {
462  }
463  else if(tempDownCase == "notice")
464  {
466  }
467  else if(tempDownCase == "all")
468  {
470  }
471  }
472 }
473 
475 {
476  std::string tempString;
477  ossimArgumentParser::ossimParameter stringParameter(tempString);
478  while(parser.read("--env", stringParameter))
479  {
480  ossimString option = tempString;
481  if (option.contains("=") )
482  {
483  ossimString delimiter = "=";
484  ossimString key (option.before(delimiter));
485  ossimString value = option.after(delimiter);
486  ossimEnvironmentUtility::instance()->setEnvironmentVariable(key.c_str(), value.c_str());
487 
488  }
489  else
490  {
491  ossimString key (option);
493  }
494  }
495 }
496 /*!****************************************************************************
497  * METHOD: ossimInit::removeOption()
498  *
499  * Removes all characters associated with the indicated option from the
500  * command line string.
501  *
502  *****************************************************************************/
503 void ossimInit::removeOption(int& argc,
504  char** argv,
505  int argToRemove)
506 {
507  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
508  << "DEBUG ossimInit::removeOption(argc, argv, argToRemove): entering..."
509  << std::endl;
510 
511  // Shift the args up by one position, overwriting the arg being removed:
512  for (int i=argToRemove+1; i<argc; i++)
513  {
514  argv[i - 1] = argv[i];
515  }
516 
517  argc--;
518  argv[argc] = 0;
519 
520  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
521  << "DEBUG ossimInit::removeOption(argc, argv, argToRemove): leaving..."
522  << std::endl;
523  return;
524 }
525 
527 {
531 
532  //---
533  // Because of how the imagehandlers work off a magic number make sure
534  // we place the writer first if we don't then the imagehandler will
535  // be false and will then try to open the filename and go through a
536  // magic number and if the file already
537  // existed it will open and create a handler instead of a writer.
538  //---
546  // Initialize the overview factories.
548  registerFactory(ossimOverviewBuilderFactory::instance(), true);
549 
551 
552  // initialize. projection factory.
554 
555  // add the view controllers
557 
559 }
560 
562 {
563 
564 #if 0
565  // Note: Removed "autoload" code. Commented out below.
566 
568 
569  //---
570  // Look for plugins in the form of:
571  // plugin0.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_png_plugin.so
572  // plugin0.option: front
573  //---
574  ossimString regExp = ossimString("^(") + "plugin[0-9]+.file)";
575  ossim_uint32 numberOfPlugins = KWL.getNumberOfSubstringKeys( regExp );
576  if ( numberOfPlugins )
577  {
578  const ossim_uint32 MAX_INDEX = numberOfPlugins + 1000; // for skipage...
579  ossim_uint32 index = 0;
580  ossim_uint32 processedIndexes = 0;
581  const std::string PREFIX_BASE = "plugin";
582  const std::string DOT = ".";
583  const std::string FILE_KEY = "file";
584  const std::string OPTIONS_KEY = "options";
585 
586  ossimString prefix;
587  ossimFilename pluginFile;
588  ossimString pluginOptions;
589 
590  // Loop to load plugins in order. Note allows for skipage.
591  while ( processedIndexes < MAX_INDEX )
592  {
593  prefix = PREFIX_BASE + ossimString::toString(index).string() + DOT;
594  pluginFile = KWL.findKey( prefix, FILE_KEY );
595  if ( pluginFile.size() )
596  {
597  if ( pluginFile.exists() )
598  {
599  // Found plugin, look for options:
600  pluginOptions = KWL.findKey( prefix, OPTIONS_KEY );
601 
602  ossimSharedPluginRegistry::instance()->registerPlugin(pluginFile, pluginOptions);
603  }
604  ++processedIndexes;
605  }
606  if ( processedIndexes == numberOfPlugins )
607  {
608  break;
609  }
610  ++index;
611  }
612  }
613 
614  //---
615  // Look for plugins in the form of:
616  // plugin.file0: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_png_plugin.so
617  //---
618  regExp = ossimString("^(") + "plugin.file[0-9]+)";
619  numberOfPlugins = KWL.getNumberOfSubstringKeys( regExp );
620  if ( numberOfPlugins )
621  {
622  const ossim_uint32 MAX_INDEX = numberOfPlugins + 1000; // for skipage...
623  ossim_uint32 index = 0;
624  ossim_uint32 processedIndexes = 0;
625  const std::string PREFIX_BASE = "plugin.file";
626  std::string fileKey;
627 
628  ossimString prefix;
629  ossimFilename pluginFile;
630  ossimString pluginOptions = ""; // No options:
631 
632  // Loop to load plugins in order. Note allows for skipage.
633  while ( processedIndexes < MAX_INDEX )
634  {
635  fileKey = PREFIX_BASE + ossimString::toString(index).string();
636  pluginFile = KWL.findKey( fileKey );
637  if ( pluginFile.size() )
638  {
639  if ( pluginFile.exists() )
640  {
641  ossimSharedPluginRegistry::instance()->registerPlugin(pluginFile, pluginOptions);
642  }
643  ++processedIndexes;
644  }
645 
646  if ( processedIndexes == numberOfPlugins )
647  {
648  break;
649  }
650  ++index;
651  }
652  }
653 
654 #else /* Old code that auto loads plugins. */
655  #if 0
656  ossimString regExpressionDir = ossimString("^(") + "plugin.dir[0-9]+)";
657  ossimString regExpressionFile = ossimString("^(") + "plugin.file[0-9]+)";
658 
660 
661  vector<ossimString> keys = kwl.getSubstringKeyList( regExpressionDir );
662 
663  ossim_uint32 numberOfDirs = (ossim_uint32)keys.size();
664  ossim_uint32 offset = (ossim_uint32)ossimString("plugin.dir").size();
665  int idx = 0;
666 
667  std::vector<int> numberList(numberOfDirs);
668 
669  // register user plugins first
671  loadPlugins(userPluginDir);
672 
673  if(numberList.size()>0)
674  {
675  for(idx = 0; idx < (int)numberList.size();++idx)
676  {
677  ossimString numberStr(keys[idx].begin() + offset,
678  keys[idx].end());
679  numberList[idx] = numberStr.toInt();
680  }
681 
682  std::sort(numberList.begin(), numberList.end());
683  for(idx=0;idx < (int)numberList.size();++idx)
684  {
685  ossimString newPrefix = "plugin.dir";
686  newPrefix += ossimString::toString(numberList[idx]);
687  const char* directory = kwl.find(newPrefix.c_str());
688 
689  if(directory)
690  {
691  loadPlugins(ossimFilename(directory));
692  }
693  }
694  }
695  keys = kwl.getSubstringKeyList( regExpressionFile );
696 
697  ossim_uint32 numberOfFiles = (ossim_uint32)keys.size();
698  offset = (ossim_uint32)ossimString("plugin.file").size();
699  numberList.resize(numberOfFiles);
700  if(numberList.size()>0)
701  {
702  for(idx = 0; idx < (int)numberList.size();++idx)
703  {
704  ossimString numberStr(keys[idx].begin() + offset,
705  keys[idx].end());
706  numberList[idx] = numberStr.toInt();
707  }
708 
709  std::sort(numberList.begin(), numberList.end());
710  for(idx=0;idx < (int)numberList.size();++idx)
711  {
712  ossimString newPrefix="plugin.file";
713  newPrefix += ossimString::toString(numberList[idx]);
714  const char* file = kwl.find(newPrefix.c_str());
715 
716  if(file&&ossimFilename(file).exists())
717  {
718  loadPlugins(file);
719 // ossimSharedPluginRegistry::instance()->registerPlugin(file);
720  }
721  }
722  }
723  #endif
724  // now check new plugin loading that supports passing options to the plugins
725  //
727  ossimString regExpressionFile = ossimString("^(") + "plugin[0-9]+\\.file)";
728  vector<ossimString> keys = kwl.getSubstringKeyList( regExpressionFile );
729 
730  ossim_uint32 numberOfFiles = (ossim_uint32)keys.size();
731  ossim_uint32 offset = (ossim_uint32)ossimString("plugin").size();
732  std::vector<int> numberList(numberOfFiles);
733 
734  if(numberList.size()>0)
735  {
736  ossim_uint32 idx = 0;
737  for(idx = 0; idx < numberList.size();++idx)
738  {
739  ossimString numberStr(keys[idx].begin() + offset,
740  keys[idx].end());
741  numberList[idx] = numberStr.toInt();
742  }
743  std::sort(numberList.begin(), numberList.end());
744  ossimFilename pluginFile;
745  ossimString options;
746  for(std::vector<ossim_int32>::const_iterator iter = numberList.begin();
747  iter != numberList.end();++iter)
748  {
749  ossimString newPrefix = ossimString("plugin")+ossimString::toString(*iter) + ".";
750 
751  pluginFile = kwl.find((newPrefix+"file").c_str());
752  options = kwl.find((newPrefix+"options").c_str());
753  if(pluginFile.exists())
754  {
755  ossimSharedPluginRegistry::instance()->registerPlugin(pluginFile, options);
756  }
757  }
758  }
759 
760  regExpressionFile = ossimString("^(") + "plugin.file[0-9]+)";
761  keys = kwl.getSubstringKeyList( regExpressionFile );
762 
763  numberOfFiles = (ossim_uint32)keys.size();
764  offset = (ossim_uint32)ossimString("plugin.file").size();
765  numberList.resize(numberOfFiles);
766 
767  if(numberList.size()>0)
768  {
769  ossim_uint32 idx = 0;
770  for(idx = 0; idx < numberList.size();++idx)
771  {
772  ossimString numberStr(keys[idx].begin() + offset,
773  keys[idx].end());
774  numberList[idx] = numberStr.toInt();
775  }
776  std::sort(numberList.begin(), numberList.end());
777  ossimFilename pluginFile;
778  ossimString options;
779  for(std::vector<ossim_int32>::const_iterator iter = numberList.begin();
780  iter != numberList.end();++iter)
781  {
782  ossimString newPrefix = ossimString("plugin.file")+ossimString::toString(*iter);
783 
784  pluginFile = kwl.find(newPrefix.c_str());
785  if(pluginFile.exists())
786  {
787  ossimSharedPluginRegistry::instance()->registerPlugin(pluginFile, options);
788  }
789  }
790  }
791 
792 
793 
794  ossimString auto_load_plugins(ossimPreferences::instance()->findPreference("ossim_init.auto_load_plugins"));
795 
796  if(auto_load_plugins.empty()) auto_load_plugins = "false";
797  // now load any plugins not found in the keywordlist
798  //
799  // check for plugins in the current directory
800  // and load them
801  if(auto_load_plugins.toBool())
802  {
803  ossimFilename ossimpluginsDir = ossimFilename(theAppName).dirCat("ossimplugins");
804  ossimDirectory currentDir(theAppName.path());
805 
806  if(ossimpluginsDir.exists())
807  {
808  currentDir = ossimpluginsDir;
809  }
810  std::vector<ossimFilename> result;
811  currentDir.findAllFilesThatMatch(result, "ossim.*plugin.*", ossimDirectory::OSSIM_DIR_FILES);
812 
813  if(result.size())
814  {
815  ossim_uint32 idx = 0;
816  for(idx = 0; idx < result.size(); ++idx)
817  {
819  }
820  }
821  }
822 #endif
823 }
824 
826 {
827  if (traceDebug()) ossimNotify(ossimNotifyLevel_DEBUG)
828  << "DEBUG ossimInit::initializeElevation(): Entered..." << std::endl;
829 
831 
832 #if 0 /* All autoload stuff disabled. drb 20170408 */
833  ossimFilename appPath = theAppName.path();
834 
835  // look for bundled elevation and geoids
836  {
837  ossimFilename geoid = appPath.dirCat("geoids");
838  geoid = geoid.dirCat("geoid1996");
839  geoid = geoid.dirCat("egm96.grd");
840  if(geoid.exists())
841  {
842  ossimGeoid* geoidPtr = new ossimGeoidEgm96(geoid);
843 
844  if (geoidPtr->getErrorStatus() == ossimErrorCodes::OSSIM_OK)
845  {
847  }
848 
849  }
850  }
851 #endif
852 
854 
855  //---
856  // Auto load removed to avoid un-wanted directory scanning.
857  // Use ossim preferences. drb - 28 March 2016.
858  //---
859 #if 0
860  ossimFilename elevation = appPath.dirCat("elevation");
861  if(elevation.exists())
862  {
864  }
865 #endif
866 
867  // lets do backward compatability here
868  //
869  ossimString regExpression = ossimString("^(") + "elevation_source[0-9]+.)";
870  vector<ossimString> keys =
871  KWL.getSubstringKeyList( regExpression );
872  if(!keys.empty())
873  {
874  ossimNotify(ossimNotifyLevel_WARN) << "Please specify elevation_source keywords with the new prefix\n"
875  << "of elevation_manager.elevation_source....\n";
876  thePreferences->preferencesKWL().addPrefixToKeysThatMatch("elevation_manager.", regExpression);
877  }
878  ossimElevManager::instance()->loadState(KWL, "elevation_manager.");
879 
880  if (traceDebug()) ossimNotify(ossimNotifyLevel_DEBUG)
881  << "DEBUG ossimInit::initializeElevation(): leaving..." << std::endl;
882 }
883 
885 {
886  //---
887  // Do not set if already as --ossim-logfile take precidence over preferences
888  // file.
889  //---
890  ossimFilename logFile;
891  ossimGetLogFilename(logFile);
892 
893  if ( (logFile.size() == 0) && thePreferences )
894  {
895  const char* lookup =
896  thePreferences->preferencesKWL().find("ossim.log.file");
897  if (lookup)
898  {
899  logFile = lookup;
900  ossimSetLogFilename(logFile);
901  }
902  }
903 }
904 
906 {
907  ossimString versionString;
908 #ifdef OSSIM_VERSION
909  versionString += OSSIM_VERSION;
910 #else
911  versionString += "Version ?.?.?";
912 #endif
913 
914  versionString += " ";
915 
916 #ifdef OSSIM_BUILD_DATE
917  versionString += OSSIM_BUILD_DATE;
918 #else
919  versionString += "(yyyymmdd)";
920 #endif
921 
922  return versionString;
923 }
924 
926 {
927  return theAppName;
928 }
929 
930 ossimInit::ossimInit(const ossimInit& /* obj */ )
931 : theInitializedFlag(false),
932  theAppName(),
933  thePreferences(ossimPreferences::instance()),
934  theElevEnabledFlag(true),
935  thePluginLoaderEnabledFlag(true)
936 {}
937 
938 void ossimInit::operator=(const ossimInit& /* rhs */) const
939 {}
static ossimCodecFactoryRegistry * instance()
void parseEnvOptions(ossimArgumentParser &parser)
Definition: ossimInit.cpp:474
const ossimKeywordlist & preferencesKWL() const
void addCommandLineOption(const ossimString &option, const ossimString &explanation)
static ossimTraceManager * instance()
static ossimImageGeometryRegistry * instance()
void addPrefixToKeysThatMatch(const ossimString &prefix, const ossimString &regularExpression)
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
void parseOptions(ossimArgumentParser &parser)
Definition: ossimInit.cpp:379
static std::shared_ptr< ossim::ImageHandlerStateFactory > instance()
const ossimString & getApplicationName() const
ossim_uint32 getNumberOfSubstringKeys(const ossimString &regularExpression) const
bool theElevEnabledFlag
Definition: ossimInit.h:150
OSSIMDLLEXPORT void ossimGetLogFilename(ossimFilename &logFile)
Returns the log filename if set.
void initialize(int &argc, char **argv)
Definition: ossimInit.cpp:119
void initializePlugins()
Definition: ossimInit.cpp:561
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimFilename appName() const
Definition: ossimInit.cpp:925
static const ossimErrorCode OSSIM_OK
static ossimDatumFactoryRegistry * instance()
instance method
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
const char * find(const char *key) const
void addOptions(ossimArgumentParser &parser)
Definition: ossimInit.cpp:100
static ossimBaseObjectFactory * instance()
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
bool theInitializedFlag
Definition: ossimInit.h:147
bool read(const std::string &str)
search for an occurance of a string in the argument list, on sucess remove that occurance from the li...
void loadPlugins(const ossimFilename &plugin, const char *options=0)
Can take a file or a directory.
Definition: ossimInit.cpp:305
void removeOption(int &argc, char **argv, int argToRemove)
Definition: ossimInit.cpp:503
bool contains(char aChar) const
Definition: ossimString.h:58
static ossimImageWriterFactoryRegistry * instance()
void operator=(const ossimInit &rhs) const
Hidden from use assignment operator.
Definition: ossimInit.cpp:938
static ossimString toString(bool aValue)
Numeric to string methods.
ossimFilename getUserOssimPluginDir() const
static ossimOverviewBuilderFactory * instance()
static instance method.
static ossimObjectFactoryRegistry * instance()
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
static StreamFactoryRegistry * instance()
OSSIMDLLEXPORT void ossimDisableNotify(ossimNotifyFlags notifyLevel=ossimNotifyFlags_ALL)
bool thePluginLoaderEnabledFlag
Definition: ossimInit.h:151
ossimApplicationUsage * getApplicationUsage()
bool isDir() const
void parseNotifyOption(ossimArgumentParser &parser)
Definition: ossimInit.cpp:438
bool getNext(ossimFilename &filename) const
void finalize()
Definition: ossimInit.cpp:261
void parsePrefsOptions(ossimArgumentParser &parser)
Definition: ossimInit.cpp:335
void initializeElevation()
Definition: ossimInit.cpp:825
void setTracePattern(const ossimString &pattern)
Sets "thePattern" to "pattern", then calls setTraceFlags(true).
ossimPreferences * thePreferences
Definition: ossimInit.h:149
ossimInit()
protected default constructor.
Definition: ossimInit.cpp:79
void initializeDefaultFactories()
Definition: ossimInit.cpp:526
void addFactory(T *factory)
This is for backward compatability and calls registerFactory for simple adds.
static ossimSharedPluginRegistry * instance()
bool exists() const
std::string::size_type size() const
Definition: ossimString.h:405
bool toBool() const
String to numeric methods.
unsigned int ossim_uint32
static ossimGeoidManager * instance()
Implements singelton pattern:
bool getElevEnabledFlag() const
Definition: ossimInit.cpp:290
bool loadElevationPath(const ossimFilename &path, bool set_as_first=false)
Adds a new elevation file (or multiple files if path is a directory) to the collection.
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual void addGeoid(ossimRefPtr< ossimGeoid > geoid, bool toFrontFlag=false)
Permits adding additional geoids to the list:
void registerFactory(T *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.
void setElevEnabledFlag(bool flag)
Sets theElevEnabledFlag.
Definition: ossimInit.cpp:295
static ossimPreferences * instance()
bool open(const ossimFilename &dir)
void initializeLogFile()
Initializes log file from preferences keyword lookup of "ossim.log.file" if log file has not already ...
Definition: ossimInit.cpp:884
void addPreference(const char *key, const char *value)
static ossimProjectionFactoryRegistry * instance()
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
static ossimOverviewBuilderFactoryRegistry * instance()
instance method for access to theInstance pointer.
static ossimEnvironmentUtility * instance()
static ossimProjectionViewControllerFactory * instance()
static ossimFontFactoryRegistry * instance()
virtual ossimErrorCode getErrorStatus() const
void setPluginLoaderEnabledFlag(bool flag)
Definition: ossimInit.cpp:300
ossimFilename theAppName
Definition: ossimInit.h:148
OSSIMDLLEXPORT void ossimSetLogFilename(const ossimFilename &filename)
ossimFilename dirCat(const ossimFilename &file) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
static std::shared_ptr< ImageHandlerStateRegistry > instance()
static ossim2dTo2dTransformRegistry * instance()
bool registerPlugin(const ossimFilename &filename, const ossimString &options="")
static ossimInit * instance()
Definition: ossimInit.cpp:89
ossimString getEnvironmentVariable(const ossimString &variable) const
static ossimImageHandlerRegistry * instance()
void initialize()
Definition: ossimInit.cpp:190
void setEnvironmentVariable(const char *variable, const char *value) const
static ossimInit * theInstance
Definition: ossimInit.h:146
#define OSSIM_VERSION
Definition: ossimVersion.h:4
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
ossimString version() const
Definition: ossimInit.cpp:905
ossimFilename path() const
#define OSSIM_BUILD_DATE
Definition: ossimVersion.h:12
static ossimImageSourceFactoryRegistry * instance()
int toInt() const
ossimFilename getPreferencesFilename() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
static ossimImageMetaDataWriterRegistry * instance()
const std::string & string() const
Definition: ossimString.h:414
void usage()
Definition: ossimInit.cpp:268