text:
namespace lldb {

class SBPlatform;

class LLDB_API SBTarget {
public:
  // Broadcaster bits.
  enum {
    eBroadcastBitBreakpointChanged = (1 << 0),
    eBroadcastBitModulesLoaded = (1 << 1),
    eBroadcastBitModulesUnloaded = (1 << 2),
    eBroadcastBitWatchpointChanged = (1 << 3),
    eBroadcastBitSymbolsLoaded = (1 << 4)
  };

  // Constructors
  SBTarget();

  SBTarget(const lldb::SBTarget &rhs);

  SBTarget(const lldb::TargetSP &target_sp);

  // Destructor
  ~SBTarget();

  const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);

  explicit operator bool() const;

  bool IsValid() const;

  static bool EventIsTargetEvent(const lldb::SBEvent &event);

  static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);

  static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);

  static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
                                                  const lldb::SBEvent &event);

  static const char *GetBroadcasterClassName();

  lldb::SBProcess GetProcess();

  /// Sets whether we should collect statistics on lldb or not.
  ///
  /// \param[in] v
  ///     A boolean to control the collection.
  void SetCollectingStats(bool v);

  /// Returns whether statistics collection are enabled.
  ///
  /// \return
  ///     true if statistics are currently being collected, false
  ///     otherwise.
  bool GetCollectingStats();

  /// Returns a dump of the collected statistics.
  ///
  /// \return
  ///     A SBStructuredData with the statistics collected.
  lldb::SBStructuredData GetStatistics();

  /// Return the platform object associated with the target.
  ///
  /// After return, the platform object should be checked for
  /// validity.
  ///
  /// \return
  ///     A platform object.
  lldb::SBPlatform GetPlatform();

  /// Install any binaries that need to be installed.
  ///
  /// This function does nothing when debugging on the host system.
  /// When connected to remote platforms, the target's main executable
  /// and any modules that have their remote install path set will be
  /// installed on the remote platform. If the main executable doesn't
  /// have an install location set, it will be installed in the remote
  /// platform's working directory.
  ///
  /// \return
  ///     An error describing anything that went wrong during
  ///     installation.
  SBError Install();

  /// Launch a new process.
  ///
  /// Launch a new process by spawning a new process using the
  /// target object's executable module's file as the file to launch.
  /// Arguments are given in \a argv, and the environment variables
  /// are in \a envp. Standard input and output files can be
  /// optionally re-directed to \a stdin_path, \a stdout_path, and
  /// \a stderr_path.
  ///
  /// \param[in] listener
  ///     An optional listener that will receive all process events.
  ///     If \a listener is valid then \a listener will listen to all
  ///     process events. If not valid, then this target's debugger
  ///     (SBTarget::GetDebugger()) will listen to all process events.
  ///
  /// \param[in] argv
  ///     The argument array.
  ///
  /// \param[in] envp
  ///     The environment array.
  ///
  /// \param[in] stdin_path
  ///     The path to use when re-directing the STDIN of the new
  ///     process. If all stdXX_path arguments are nullptr, a pseudo
  ///     terminal will be used.
  ///
  /// \param[in] stdout_path
  ///     The path to use when re-directing the STDOUT of the new
  ///     process. If all stdXX_path arguments are nullptr, a pseudo
  ///     terminal will be used.
  ///
  /// \param[in] stderr_path
  ///     The path to use when re-directing the STDERR of the new
  ///     process. If all stdXX_path arguments are nullptr, a pseudo
  ///     terminal will be used.
  ///
  /// \param[in] working_directory
  ///     The working directory to have the child process run in
  ///
  /// \param[in] launch_flags
  ///     Some launch options specified by logical OR'ing
  ///     lldb::LaunchFlags enumeration values together.
  ///
  /// \param[in] stop_at_entry
  ///     If false do not stop the inferior at the entry point.
  ///
  /// \param[out] error
  ///     An error object. Contains the reason if there is some failure.
  ///
  /// \return
  ///      A process object for the newly created process.
  lldb::SBProcess Launch(SBListener &listener, char const **argv,
                         char const **envp, const char *stdin_path,
                         const char *stdout_path, const char *stderr_path,
                         const char *working_directory,
                         uint32_t launch_flags, // See LaunchFlags
                         bool stop_at_entry, lldb::SBError &error);

  SBProcess LoadCore(const char *core_file);
  SBProcess LoadCore(const char *core_file, lldb::SBError &error);

  /// Launch a new process with sensible defaults.
  ///
  /// \param[in] argv
  ///     The argument array.
  ///
  /// \param[in] envp
  ///     The environment array.
  ///
  /// \param[in] working_directory
  ///     The working directory to have the child process run in
  ///
  /// Default: listener
  ///     Set to the target's debugger (SBTarget::GetDebugger())
  ///
  /// Default: launch_flags
  ///     Empty launch flags
  ///
  /// Default: stdin_path
  /// Default: stdout_path
  /// Default: stderr_path
  ///     A pseudo terminal will be used.
  ///
  /// \return
  ///      A process object for the newly created process.
  SBProcess LaunchSimple(const char **argv, const char **envp,
                         const char *working_directory);

  SBProcess Launch(SBLaunchInfo &launch_info, SBError &error);

  SBProcess Attach(SBAttachInfo &attach_info, SBError &error);

  /// Attach to process with pid.
  ///
  /// \param[in] listener
  ///     An optional listener that will receive all process events.
  ///     If \a listener is valid then \a listener will listen to all
  ///     process events. If not valid, then this target's debugger
  ///     (SBTarget::GetDebugger()) will listen to all process events.
  ///
  /// \param[in] pid
  ///     The process ID to attach to.
  ///
  /// \param[out] error
  ///     An error explaining what went wrong if attach fails.
  ///
  /// \return
  ///      A process object for the attached process.
  lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
                                        lldb::SBError &error);

  /// Attach to process with name.
  ///
  /// \param[in] listener
  ///     An optional listener that will receive all process events.
  ///     If \a listener is valid then \a listener will listen to all
  ///     process events. If not valid, then this target's debugger
  ///     (SBTarget::GetDebugger()) will listen to all process events.
  ///
  /// \param[in] name
  ///     Basename of process to attach to.
  ///
  /// \param[in] wait_for
  ///     If true wait for a new instance of 'name' to be launched.
  ///
  /// \param[out] error
  ///     An error explaining what went wrong if attach fails.
  ///
  /// \return
  ///      A process object for the attached process.
  lldb::SBProcess AttachToProcessWithName(SBListener &listener,
                                          const char *name, bool wait_for,
                                          lldb::SBError &error);

  /// Connect to a remote debug server with url.
  ///
  /// \param[in] listener
  ///     An optional listener that will receive all process events.
  ///     If \a listener is valid then \a listener will listen to all
  ///     process events. If not valid, then this target's debugger
  ///     (SBTarget::GetDebugger()) will listen to all process events.
  ///
  /// \param[in] url
  ///     The url to connect to, e.g., 'connect://localhost:12345'.
  ///
  /// \param[in] plugin_name
  ///     The plugin name to be used; can be nullptr.
  ///
  /// \param[out] error
  ///     An error explaining what went wrong if the connect fails.
  ///
  /// \return
  ///      A process object for the connected process.
  lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
                                const char *plugin_name, SBError &error);

  lldb::SBFileSpec GetExecutable();

  // Append the path mapping (from -> to) to the target's paths mapping list.
  void AppendImageSearchPath(const char *from, const char *to,
                             lldb::SBError &error);

  bool AddModule(lldb::SBModule &module);

  lldb::SBModule AddModule(const char *path, const char *triple,
                           const char *uuid);

  lldb::SBModule AddModule(const char *path, const char *triple,
                           const char *uuid_cstr, const char *symfile);

  lldb::SBModule AddModule(const SBModuleSpec &module_spec);

  uint32_t GetNumModules() const;

  lldb::SBModule GetModuleAtIndex(uint32_t idx);

  bool RemoveModule(lldb::SBModule module);

  lldb::SBDebugger GetDebugger() const;

  lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);

  /// Find compile units related to *this target and passed source
  /// file.
  ///
  /// \param[in] sb_file_spec
  ///     A lldb::SBFileSpec object that contains source file
  ///     specification.
  ///
  /// \return
  ///     A lldb::SBSymbolContextList that gets filled in with all of
  ///     the symbol contexts for all the matches.
  lldb::SBSymbolContextList
  FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);

  lldb::ByteOrder GetByteOrder();

  uint32_t GetAddressByteSize();

  const char *GetTriple();

  /// Architecture data byte width accessor
  ///
  /// \return
  /// The size in 8-bit (host) bytes of a minimum addressable
  /// unit from the Architecture's data bus
  uint32_t GetDataByteSize();

  /// Architecture code byte width accessor
  ///
  /// \return
  /// The size in 8-bit (host) bytes of a minimum addressable
  /// unit from the Architecture's code bus
  uint32_t GetCodeByteSize();

  /// Set the base load address for a module section.
  ///
  /// \param[in] section
  ///     The section whose base load address will be set within this
  ///     target.
  ///
  /// \param[in] section_base_addr
  ///     The base address for the section.
  ///
  /// \return
  ///      An error to indicate success, fail, and any reason for
  ///     failure.
  lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
                                      lldb::addr_t section_base_addr);

  /// Clear the base load address for a module section.
  ///
  /// \param[in] section
  ///     The section whose base load address will be cleared within
  ///     this target.
  ///
  /// \return
  ///      An error to indicate success, fail, and any reason for
  ///     failure.
  lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);

  /// Slide all file addresses for all module sections so that \a module
  /// appears to loaded at these slide addresses.
  ///
  /// When you need all sections within a module to be loaded at a
  /// rigid slide from the addresses found in the module object file,
  /// this function will allow you to easily and quickly slide all
  /// module sections.
  ///
  /// \param[in] module
  ///     The module to load.
  ///
  /// \param[in] sections_offset
  ///     An offset that will be applied to all section file addresses
  ///     (the virtual addresses found in the object file itself).
  ///
  /// \return
  ///     An error to indicate success, fail, and any reason for
  ///     failure.
  lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
                                     int64_t sections_offset);

  /// Clear the section base load addresses for all sections in a module.
  ///
  /// \param[in] module
  ///     The module to unload.
  ///
  /// \return
  ///     An error to indicate success, fail, and any reason for
  ///     failure.
  lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);

  /// Find functions by name.
  ///
  /// \param[in] name
  ///     The name of the function we are looking for.
  ///
  /// \param[in] name_type_mask
  ///     A logical OR of one or more FunctionNameType enum bits that
  ///     indicate what kind of names should be used when doing the
  ///     lookup. Bits include fully qualified names, base names,
  ///     C++ methods, or ObjC selectors.
  ///     See FunctionNameType for more details.
  ///
  /// \return
  ///     A lldb::SBSymbolContextList that gets filled in with all of
  ///     the symbol contexts for all the matches.
  lldb::SBSymbolContextList
  FindFunctions(const char *name,
                uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

  /// Find global and static variables by name.
  ///
  /// \param[in] name
  ///     The name of the global or static variable we are looking
  ///     for.
  ///
  /// \param[in] max_matches
  ///     Allow the number of matches to be limited to \a max_matches.
  ///
  /// \return
  ///     A list of matched variables in an SBValueList.
  lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);

  /// Find the first global (or static) variable by name.
  ///
  /// \param[in] name
  ///     The name of the global or static variable we are looking
  ///     for.
  ///
  /// \return
  ///     An SBValue that gets filled in with the found variable (if any).
  lldb::SBValue FindFirstGlobalVariable(const char *name);

  /// Find global and static variables by pattern.
  ///
  /// \param[in] name
  ///     The pattern to search for global or static variables
  ///
  /// \param[in] max_matches
  ///     Allow the number of matches to be limited to \a max_matches.
  ///
  /// \param[in] matchtype
  ///     The match type to use.
  ///
  /// \return
  ///     A list of matched variables in an SBValueList.
  lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
                                        MatchType matchtype);

  /// Find global functions by their name with pattern matching.
  ///
  /// \param[in] name
  ///     The pattern to search for global or static variables
  ///
  /// \param[in] max_matches
  ///     Allow the number of matches to be limited to \a max_matches.
  ///
  /// \param[in] matchtype
  ///     The match type to use.
  ///
  /// \return
  ///     A list of matched variables in an SBValueList.
  lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
                                                uint32_t max_matches,
                                                MatchType matchtype);

  void Clear();

  /// Resolve a current file address into a section offset address.
  ///
  /// \param[in] file_addr
  ///     The file address to resolve.
  ///
  /// \return
  ///     An SBAddress which will be valid if...
  lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);

  /// Resolve a current load address into a section offset address.
  ///
  /// \param[in] vm_addr
  ///     A virtual address from the current process state that is to
  ///     be translated into a section offset address.
  ///
  /// \return
  ///     An SBAddress which will be valid if \a vm_addr was
  ///     successfully resolved into a section offset address, or an
  ///     invalid SBAddress if \a vm_addr doesn't resolve to a section
  ///     in a module.
  lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr);

  /// Resolve a current load address into a section offset address
  /// using the process stop ID to identify a time in the past.
  ///
  /// \param[in] stop_id
  ///     Each time a process stops, the process stop ID integer gets
  ///     incremented. These stop IDs are used to identify past times
  ///     and can be used in history objects as a cheap way to store
  ///     the time at which the sample was taken. Specifying
  ///     UINT32_MAX will always resolve the address using the
  ///     currently loaded sections.
  ///
  /// \param[in] vm_addr
  ///     A virtual address from the current process state that is to
  ///     be translated into a section offset address.
  ///
  /// \return
  ///     An SBAddress which will be valid if \a vm_addr was
  ///     successfully resolved into a section offset address, or an
  ///     invalid SBAddress if \a vm_addr doesn't resolve to a section
  ///     in a module.
  lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
                                         lldb::addr_t vm_addr);

  SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
                                                 uint32_t resolve_scope);

  /// Read target memory. If a target process is running then memory
  /// is read from here. Otherwise the memory is read from the object
  /// files. For a target whose bytes are sized as a multiple of host
  /// bytes, the data read back will preserve the target's byte order.
  ///
  /// \param[in] addr
  ///     A target address to read from.
  ///
  /// \param[out] buf
  ///     The buffer to read memory into.
  ///
  /// \param[in] size
  ///     The maximum number of host bytes to read in the buffer passed
  ///     into this call
  ///
  /// \param[out] error
  ///     Status information is written here if the memory read fails.
  ///
  /// \return
  ///     The amount of data read in host bytes.
  size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
                    lldb::SBError &error);

  lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
                                                uint32_t line);

  lldb::SBBreakpoint
  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);

  lldb::SBBreakpoint
  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
                             lldb::addr_t offset);

  lldb::SBBreakpoint
  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
                             lldb::addr_t offset, SBFileSpecList &module_list);

  lldb::SBBreakpoint
  BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
                             uint32_t column, lldb::addr_t offset,
                             SBFileSpecList &module_list);

  lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
                                            const char *module_name = nullptr);

  // This version uses name_type_mask = eFunctionNameTypeAuto, symbol_language =
  // eLanguageTypeUnknown
  lldb::SBBreakpoint
  BreakpointCreateByName(const char *symbol_name,
                         const SBFileSpecList &module_list,
                         const SBFileSpecList &comp_unit_list);

  // symbol_language = eLanguageTypeUnknown.
  lldb::SBBreakpoint BreakpointCreateByName(
      const char *symbol_name,
      uint32_t
          name_type_mask, // Logical OR one or more FunctionNameType enum bits
      const SBFileSpecList &module_list,
      const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint BreakpointCreateByName(
      const char *symbol_name,
      uint32_t
          name_type_mask, // Logical OR one or more FunctionNameType enum bits
      lldb::LanguageType symbol_language,
      const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint BreakpointCreateByNames(
      const char *symbol_name[], uint32_t num_names,
      uint32_t
          name_type_mask, // Logical OR one or more FunctionNameType enum bits
      const SBFileSpecList &module_list,
      const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint BreakpointCreateByNames(
      const char *symbol_name[], uint32_t num_names,
      uint32_t
          name_type_mask, // Logical OR one or more FunctionNameType enum bits
      lldb::LanguageType symbol_language,
      const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint BreakpointCreateByNames(
      const char *symbol_name[], uint32_t num_names,
      uint32_t
          name_type_mask, // Logical OR one or more FunctionNameType enum bits
      lldb::LanguageType symbol_language,
      lldb::addr_t offset, const SBFileSpecList &module_list,
      const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
                                             const char *module_name = nullptr);

  lldb::SBBreakpoint
  BreakpointCreateByRegex(const char *symbol_name_regex,
                          const SBFileSpecList &module_list,
                          const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint BreakpointCreateByRegex(
      const char *symbol_name_regex, lldb::LanguageType symbol_language,
      const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);

  lldb::SBBreakpoint
  BreakpointCreateBySourceRegex(const char *source_regex,
                                const SBFileSpec &source_file,
                                const char *module_name = nullptr);

  lldb::SBBreakpoint
  BreakpointCreateBySourceRegex(const char *source_regex,
                                const SBFileSpecList &module_list,
                                const SBFileSpecList &source_file);

  lldb::SBBreakpoint BreakpointCreateBySourceRegex(
      const char *source_regex, const SBFileSpecList &module_list,
      const SBFileSpecList &source_file, const SBStringList &func_names);

  lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
                                                  bool catch_bp, bool throw_bp);

  // The extra_args parameter will hold any number of pairs, the first element
  // is the extra
  // argument type, and the second the value.
  // The argument types all follow the option long name from "breakpoint set -E
  // <Language>".
  lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
                                                  bool catch_bp, bool throw_bp,
                                                  SBStringList &extra_args);

  lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);

  lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);

  /// Create a breakpoint using a scripted resolver.
  ///
  /// \param[in] class_name
  ///    This is the name of the class that implements a scripted resolver.
  ///
  /// \param[in] extra_args
  ///    This is an SBStructuredData object that will get passed to the
  ///    constructor of the class in class_name.  You can use this to
  ///    reuse the same class, parametrizing with entries from this
  ///    dictionary.
  ///
  /// \param module_list
  ///    If this is non-empty, this will be used as the module filter in the
  ///    SearchFilter created for this breakpoint.
  ///
  /// \param file_list
  ///    If this is non-empty, this will be used as the comp unit filter in the
  ///    SearchFilter created for this breakpoint.
  ///
  /// \return
  ///     An SBBreakpoint that will set locations based on the logic in the
  ///     resolver's search callback.
  lldb::SBBreakpoint BreakpointCreateFromScript(
      const char *class_name,
      SBStructuredData &extra_args,
      const SBFileSpecList &module_list,
      const SBFileSpecList &file_list,
      bool request_hardware = false);

  /// Read breakpoints from source_file and return the newly created
  /// breakpoints in bkpt_list.
  ///
  /// \param[in] source_file
  ///    The file from which to read the breakpoints.
  ///
  /// \param[out] new_bps
  ///    A list of the newly created breakpoints.
  ///
  /// \return
  ///     An SBError detailing any errors in reading in the breakpoints.
  lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
                                          SBBreakpointList &new_bps);

  /// Read breakpoints from source_file and return the newly created
  /// breakpoints in bkpt_list.
  ///
  /// \param[in] source_file
  ///    The file from which to read the breakpoints.
  ///
  /// \param[in] matching_names
  ///    Only read in breakpoints whose names match one of the names in this
  ///    list.
  ///
  /// \param[out] new_bps
  ///    A list of the newly created breakpoints.
  ///
  /// \return
  ///     An SBError detailing any errors in reading in the breakpoints.
  lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
                                          SBStringList &matching_names,
                                          SBBreakpointList &new_bps);

  /// Write breakpoints to dest_file.
  ///
  /// \param[in] dest_file
  ///    The file to which to write the breakpoints.
  ///
  /// \return
  ///     An SBError detailing any errors in writing in the breakpoints.
  lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);

  /// Write breakpoints listed in bkpt_list to dest_file.
  ///
  /// \param[in] dest_file
  ///    The file to which to write the breakpoints.
  ///
  /// \param[in] bkpt_list
  ///    Only write breakpoints from this list.
  ///
  /// \param[in] append
  ///    If \b true, append the breakpoints in bkpt_list to the others
  ///    serialized in dest_file.  If dest_file doesn't exist, then a new
  ///    file will be created and the breakpoints in bkpt_list written to it.
  ///
  /// \return
  ///     An SBError detailing any errors in writing in the breakpoints.
  lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
                                       SBBreakpointList &bkpt_list,
                                       bool append = false);

  uint32_t GetNumBreakpoints() const;

  lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;

  bool BreakpointDelete(break_id_t break_id);

  lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);

  // Finds all breakpoints by name, returning the list in bkpt_list.  Returns
  // false if the name is not a valid breakpoint name, true otherwise.
  bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);

  void GetBreakpointNames(SBStringList &names);

  void DeleteBreakpointName(const char *name);

  bool EnableAllBreakpoints();

  bool DisableAllBreakpoints();

  bool DeleteAllBreakpoints();

  uint32_t GetNumWatchpoints() const;

  lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;

  bool DeleteWatchpoint(lldb::watch_id_t watch_id);

  lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);

  lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
                                  bool write, SBError &error);

  bool EnableAllWatchpoints();

  bool DisableAllWatchpoints();

  bool DeleteAllWatchpoints();

  lldb::SBBroadcaster GetBroadcaster() const;

  lldb::SBType FindFirstType(const char *type);

  lldb::SBTypeList FindTypes(const char *type);

  lldb::SBType GetBasicType(lldb::BasicType type);

  lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
                                       lldb::SBType type);

  lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
                                    lldb::SBType type);

  lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);

  SBSourceManager GetSourceManager();

  lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
                                           uint32_t count);

  lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
                                           uint32_t count,
                                           const char *flavor_string);

  lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
                                          const void *buf, size_t size);

  // The "WithFlavor" is necessary to keep SWIG from getting confused about
  // overloaded arguments when using the buf + size -> Python Object magic.

  lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
                                                    const char *flavor_string,
                                                    const void *buf,
                                                    size_t size);

  lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
                                          const void *buf, size_t size);

  lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
                                                    const char *flavor_string,
                                                    const void *buf,
                                                    size_t size);

  lldb::SBSymbolContextList FindSymbols(const char *name,
                                        lldb::SymbolType type = eSymbolTypeAny);

  bool operator==(const lldb::SBTarget &rhs) const;

  bool operator!=(const lldb::SBTarget &rhs) const;

  bool GetDescription(lldb::SBStream &description,
                      lldb::DescriptionLevel description_level);

  lldb::SBValue EvaluateExpression(const char *expr);

  lldb::SBValue EvaluateExpression(const char *expr,
                                   const SBExpressionOptions &options);

  lldb::addr_t GetStackRedZoneSize();

  lldb::SBLaunchInfo GetLaunchInfo() const;

  void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);

protected:
  friend class SBAddress;
  friend class SBBlock;
  friend class SBBreakpointList;
  friend class SBBreakpointNameImpl;
  friend class SBDebugger;
  friend class SBExecutionContext;
  friend class SBFunction;
  friend class SBInstruction;
  friend class SBModule;
  friend class SBProcess;
  friend class SBSection;
  friend class SBSourceManager;
  friend class SBSymbol;
  friend class SBValue;
  friend class SBVariablesOptions;

  // Constructors are private, use static Target::Create function to create an
  // instance of this class.

  lldb::TargetSP GetSP() const;

  void SetSP(const lldb::TargetSP &target_sp);

private:
  lldb::TargetSP m_opaque_sp;
};

} // namespace lldb

#endif // LLDB_SBTarget_h_


text:
<dom-module id="ghvz-inactive-dialog">

  <template>
    <template is="dom-if" if="[[player]]">
      <paper-dialog modal id="dialog" on-iron-overlay-closed="onClosed_">

Welcome back! Still human?

(Why do I see this?)

          <paper-button dialog-dismiss>Yes, I'm human!</paper-button>
          <paper-button dialog-confirm>No, glory to the horde!</paper-button>

      </paper-dialog>
    </template>
  </template>
</dom-module>

redpajama_set_name: RedPajamaGithub


text:
<app-navbar layout="column">
</app-navbar>

<md-content layout="column" layout-fill>

History

        <md-card md-theme="monarchAppTheme" md-theme-watch="">

            <md-card-title>
                <md-card-title-text>
                    {{capture.activity_spec.schema_config.title}}
                </md-card-title-text>
            </md-card-title>

            <md-card-content>
                {{capture.capture.value}}
            </md-card-content>

        </md-card>

</md-content>


text:
<?php namespace DMA\Friends\Classes\Notifications\Channels;

use Log;
use DMA\Friends\Classes\Notifications\Channels\Channel;
use DMA\Friends\Classes\Notifications\Channels\Listenable;
use DMA\Friends\Classes\Notifications\NotificationMessage;
use DMA\Friends\Classes\Notifications\IncomingMessage;

/**
 * Channel used for testing
 * @author Carlos Arroyo
 *
 */
class ChannelDummy implements Channel, Listenable
{

	/**
	 * {@inheritDoc}
	 * @see \DMA\Friends\Classes\Notifications\Channels\Channel::getKey()
	 */
    public static function getKey()
	{
		return 'dummy';
	}

	/**
	 * {@inheritDoc}
	 * @see \DMA\Friends\Classes\Notifications\Channels\Channel::getDetails()
	 */
	public function getDetails()
	{
	    return [
	            'name'           => 'Dummy',
	            'description'    => 'Channel useful for testing and debuging. All notifications are send to OctoberCMS log system.'
	    ];
	}

    /**
     * {@inheritDoc}
     * @see \DMA\Friends\Classes\Notifications\Channels\Channel::configChannel()
     */
	public function configChannel()
	{
        // This channel don't requires configurations
	}

	/**
	 * {@inheritDoc}
	 * @see \DMA\Friends\Classes\Notifications\Channels\Channel::settingFields()
	 */
	public function settingFields()
	{
		/*
	    return [
            'dummy_var' => [
                'label' => 'Dummy variable',
                'span'  => 'auto'
		    ],
		];
		*/

	}

	/**
	 * {@inheritDoc}
	 * @see \DMA\Friends\Classes\Notifications\Channels\Channel::send()
	 */
	public function send(NotificationMessage $message)
	{
	    $data = $message->getData();

	    // Send notification to log
	    Log::info('Send a dummny notification', $data);
	}

    /**
     * {@inheritDoc}
     * @see \DMA\Friends\Classes\Notifications\Channels\Listenable::read()
     */
	public function read()
	{

	    $message = new IncomingMessage($this->getKey());
	    $message->from('Julio');
	    $message->setContent(' DMA    345345.34543  ');
	    return [$message];

	}
}


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Params } from '@angular/router';
import { NoDeviceConnectedSvgComponent } from './nodeviceconnectedsvg.component';
import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import {
    FnService,
    IconService,
    LionService,
    LogService,
    UrlFnService,
    TableFilterPipe,
    IconComponent,
    WebSocketService
} from 'gui2-fw-lib';
import { of } from 'rxjs';

class MockActivatedRoute extends ActivatedRoute {
    constructor(params: Params) {
        super();
        this.queryParams = of(params);
    }
}

class MockIconService {
    classes = 'active-close';
    loadIconDef() { }
}

class MockWebSocketService {
    createWebSocket() { }
    isConnected() { return false; }
    unbindHandlers() { }
    bindHandlers() { }
}

/**
 * ONOS GUI -- Topology NoDevicesConnected -- Unit Tests
 */
describe('NoDeviceConnectedSvgComponent', () => {
    let fs: FnService;
    let ar: MockActivatedRoute;
    let windowMock: Window;
    let logServiceSpy: jasmine.SpyObj<LogService>;
    let component: NoDeviceConnectedSvgComponent;
    let fixture: ComponentFixture<NoDeviceConnectedSvgComponent>;

    beforeEach(async(() => {
        const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
        ar = new MockActivatedRoute({'debug': 'panel'});

        windowMock = <any>{
        };
        fs = new FnService(ar, logSpy, windowMock);

        TestBed.configureTestingModule({
            declarations: [ NoDeviceConnectedSvgComponent ],
            providers: [
                { provide: FnService, useValue: fs },
                { provide: IconService, useClass: MockIconService },
                { provide: LogService, useValue: logSpy },
                { provide: WebSocketService, useClass: MockWebSocketService },
                { provide: 'Window', useValue: windowMock },
            ]
        }).compileComponents();
        logServiceSpy = TestBed.get(LogService);
    }));

    beforeEach(() => {
        fixture = TestBed.createComponent(NoDeviceConnectedSvgComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

    it('should create', () => {
        expect(component).toBeTruthy();
    });
});


text:
namespace spirea {

	template <typename T>
	struct enable_bit_flags_operators;

	template <typename T, typename = void>
	struct is_enabled_bit_flags_operators :
		public std::false_type
	{ };

	template <typename T>
	struct is_enabled_bit_flags_operators< T, std::void_t< decltype( enable_bit_flags_operators< T >() ) > > :
		public std::true_type
	{
		static_assert( std::is_enum_v< T > );
	};

	template <typename T>
	constexpr bool is_enabled_bit_flags_operators_v = is_enabled_bit_flags_operators< T >::value;

namespace detail {

	template <typename T>
	constexpr auto operator~(T x) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T >
	{
		return static_cast< T >( ~static_cast< std::underlying_type_t< T > >( x ) );
	}

	template <typename T>
	constexpr auto operator&(T lhs, T rhs) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T >
	{
		using underlying = std::underlying_type_t< T >;
		return static_cast< T >( static_cast< underlying >( lhs ) & static_cast< underlying >( rhs ) );
	}

	template <typename T>
	constexpr auto operator|(T lhs, T rhs) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T >
	{
		using underlying = std::underlying_type_t< T >;
		return static_cast< T >( static_cast< underlying >( lhs ) | static_cast< underlying >( rhs ) );
	}

	template <typename T>
	constexpr auto operator^(T lhs, T rhs) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T >
	{
		using underlying = std::underlying_type_t< T >;
		return static_cast< T >( static_cast< underlying >( lhs ) ^ static_cast< underlying >( rhs ) );
	}

	template <typename T>
	constexpr auto operator&=(T& lhs, T rhs) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T& >
	{
		return lhs = lhs & rhs;
	}

	template <typename T>
	constexpr auto operator|=(T& lhs, T rhs) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T& >
	{
		return lhs = lhs | rhs;
	}

	template <typename T>
	constexpr auto operator^=(T& lhs, T rhs) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, T& >
	{
		return lhs = lhs ^ rhs;
	}

} // namespace detail

} // namespace spirea

using spirea::detail::operator~;
using spirea::detail::operator&;
using spirea::detail::operator|;
using spirea::detail::operator^;
using spirea::detail::operator&=;
using spirea::detail::operator|=;
using spirea::detail::operator^=;

namespace spirea {

	template <typename T>
	constexpr auto enabled(T src, T v) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, bool >
	{
		return ( src & v ) == v;
	}

	template <typename T>
	constexpr auto disabled(T src, T v) noexcept
		-> std::enable_if_t< is_enabled_bit_flags_operators_v< T >, bool >
	{
		return !enabled( src, v );
	}

} // namespace spirea

#endif // SPIREA_BIT_FLAGS_HPP_


text:
/*
 * threadException.h
 *
 *  Created on: 11.9.2009
 *      Author: ondra
 */

#pragma once
#ifndef _LIGHTSPEED_MT_THREADEXCEPTION_H_
#define _LIGHTSPEED_MT_THREADEXCEPTION_H_

#include "../../base/exceptions/systemException.h"
#include "../threadId.h"

namespace LightSpeed {

    class Thread;

    class ThreadException: virtual public Exception {
    public:
        ThreadException(const ProgramLocation &loc):Exception(loc) {}
        ThreadException():Exception(THISLOCATION) {}
    };

    class ThreadBusyException: public ThreadException {
    public:
        ThreadBusyException(const ProgramLocation &loc)
            :Exception(loc){}

        LIGHTSPEED_EXCEPTIONFINAL;
    	static LIGHTSPEED_EXPORT const char *msgText;;

    protected:

        void message(ExceptionMsg &msg) const {
        	msg(msgText);
        }
    };

    class UnableToStartThreadException: public ThreadException, public ErrNoWithDescException {

    public:
        UnableToStartThreadException(const ProgramLocation &loc, int err)
            :Exception(loc)
            ,ErrNoWithDescException(loc,err,String(L"Unable to start thread")) {}

        LIGHTSPEED_EXCEPTIONFINAL;
            virtual const char *getStaticDesc() const {
                return "System rejected the request to star new thread. "
                    "This situation is not expected and cannot be handled. "
                    "Explore the error code to see what has happened.";
            }

            void message(ExceptionMsg &msg) const {
                ErrNoWithDescException::message(msg);
            }
    };

    class NoCurrentThreadException: public ThreadException {
    public:

        NoCurrentThreadException(const ProgramLocation &loc, ThreadId threadId)
            :Exception(loc), ThreadException(loc),
            threadId(threadId) {}

        ThreadId getThreadId() const {return threadId;}

    	static LIGHTSPEED_EXPORT const char *msgText;;
    protected:

        ThreadId threadId;

        void message(ExceptionMsg &msg) const {
        	msg(msgText);
        }

/*TODO        virtual void getMsgText(std::ostream &msg) const {
            msg << "Thread #" << ((const char *)toAsciiC(threadId)) << " has no Thread instance associated. ";
        }*/

        LIGHTSPEED_EXCEPTIONFINAL;
        virtual const char *getStaticDesc() const {
            return "Currently running thread has not been created by the LightSpeed library. "
                "Every thread in the LightSpeed library need an instance of the Thread class "
                "associated with it. Current thread has none. To allow to run foreing threads "
                "inside of the LightSpeed library, the very first action of such thread should "
                "be function Thread::attach(). This will associate choosen instance with the "
                "thread and you will able to use LightSpeed objects to work with this thread. ";
        }
    };

    ///Some functions require running or finished thread - cannot be called before thread has not started yet.
    class ThreadNotStartedException: public ThreadException {
    public:
    	ThreadNotStartedException(const ProgramLocation &loc):ThreadException(loc) {}
    	LIGHTSPEED_EXCEPTIONFINAL;

    	static LIGHTSPEED_EXPORT const char *msgText;;

    	virtual void message(ExceptionMsg &msg) const {
    		msg(msgText);
    	}

    };

    class ThreadNotRunningException: public ThreadException {
    public:
    	ThreadNotRunningException(const ProgramLocation &loc):ThreadException(loc) {}
    	LIGHTSPEED_EXCEPTIONFINAL;

    	static LIGHTSPEED_EXPORT const char *msgText;;

    	virtual void message(ExceptionMsg &msg) const {
    		msg(msgText);
    	}

    };

}

#endif /* _LIGHTSPEED_THREADEXCEPTION_H_ */


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.apesconsole.test</groupId>
  <artifactId>iot-raspberrypi3</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>
  <name>iot-raspberrypi3</name>
  <url>http://maven.apache.org</url>
	<properties>
		<applicationName>apesconsole</applicationName>
		<jdk.version>1.7</jdk.version>
		<spring.version>3.2.2.RELEASE</spring.version>
		<jstl.version>1.2</jstl.version>
		<junit.version>4.11</junit.version>
		<logback.version>1.0.13</logback.version>
		<jcl-over-slf4j.version>1.7.5</jcl-over-slf4j.version>
		<mongojavadriver.version>2.11.1</mongojavadriver.version>
		<springdata.version>1.2.1.RELEASE</springdata.version>
	</properties>

	<dependencies>

		<!-- Spring Core -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-xml -->
		<dependency>
		    <groupId>org.springframework</groupId>
		    <artifactId>spring-oxm</artifactId>
		    <version>${spring.version}</version>
		</dependency>
   		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-asl</artifactId>
			<version>1.9.5</version>
		</dependency>
		<!-- jstl -->
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>${jstl.version}</version>
		</dependency>

		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.pi4j/pi4j-core -->
		<dependency>
		    <groupId>com.pi4j</groupId>
		    <artifactId>pi4j-core</artifactId>
		    <version>1.2-SNAPSHOT</version>
		</dependency>

		<dependency>
	        <groupId>javax.servlet</groupId>
	        <artifactId>javax.servlet-api</artifactId>
	        <version>3.1.0</version>
	        <scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
			    <groupId>org.apache.maven.plugins</groupId>
			    <artifactId>maven-war-plugin</artifactId>
			    <version>2.1.1</version>
		        <configuration>
		          <archive>
		            <manifest>
		              <addClasspath>true</addClasspath>
		            </manifest>
		          </archive>
		        </configuration>
			</plugin>
		</plugins>
	</build>
	<repositories>
		<repository>
			<id>oss-snapshots-repo</id>
			<name>Sonatype OSS Maven Repository</name>
			<url>https://oss.sonatype.org/content/groups/public</url>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>always</updatePolicy>
			</snapshots>
		</repository>
	</repositories>
</project>


text:
package org.apache.metron.common.field.transformation;

import com.google.common.collect.Iterables;
import org.apache.metron.stellar.dsl.Context;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public abstract class SimpleFieldTransformation implements FieldTransformation {
  @Override
  public Map<String, Object> map (Map<String, Object> input
                                , List<String> outputField
                                , LinkedHashMap<String, Object> fieldMappingConfig
                                , Context context
                                , Map<String, Object>... sensorConfig
                                )
  {
    Object value = (input == null)
                 ? null
                 : Iterables.getFirst(input.values(), null)
                 ;
    return map(value, outputField.get(0));
  }

  public abstract Map<String, Object> map(Object input, String outputField);
}


text:
<!--
The MIT License (MIT)

Copyright (c) 2014, 2017 IBM Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->

# Setting up the MapService Server

## Requirements

Before you get started, make sure you have the following dependencies installed on your machine:

- [Eclipse IDE for Java EE Developers](https://www.eclipse.org/downloads/)
- Component from Eclipse Marketplace
  - [IBM Eclipse Tools for IBM Cloud](https://developer.ibm.com/wasdev/downloads/#asset/tools-IBM_Eclipse_Tools_for_IBM_Cloud)
  - [IBM Liberty Developer Tools for Eclipse](https://developer.ibm.com/wasdev/downloads/#asset/tools-IBM_Liberty_Developer_Tools_for_Eclipse_Oxygen)

## Database

The server can use one of the follwing database system

1. [IBM Cloudant](https://console.bluemix.net/catalog/services/cloudant)
2. MongoDB at localhost

## Deploy MapService Server

After you setup Eclipse, you have the following options to deploy server.

1. Define IBM Bluemix Server. Then push MapService app to Bluemix
[Liberty for Java / Getting started tutorial](https://console.bluemix.net/docs/runtimes/liberty/getting-started.html)
[Develop applications using IBM Eclipse Tools for IBM Cloud](https://console.bluemix.net/docs/runtimes/liberty/eclipseDevelop.html)
[Deploying apps with IBM Eclipse Tools for IBM Cloud](https://console.bluemix.net/docs/manageapps/eclipsetools/eclipsetools.html)
[Eclipse tools for IBM Cloud](https://www.ibm.com/cloud/eclipse)
[Build and deploy a sample Liberty application to Bluemix](https://www.ibm.com/developerworks/cloud/library/cl-libertyapp-bluemix/index.html)
[Options for pushing Liberty apps](https://console.bluemix.net/docs/runtimes/liberty/optionsForPushing.html)

2. Setup your own J2EE Container (WAS Liberty recommneended). Then deploy server manually.
[WebSphere Liberty](https://developer.ibm.com/wasdev/)

After you deploy MapService Server, you need to add a DB service
- If you are not using Bluemix, you need to provide `VCAP_SERVICES` Environment variable
- If `VCAP_SERVICES` is not provided, it tries to connect to Mongo DB at localhost:27017

You need to add the following environment variable for administoration instances
- ENABLE_MAP_ACCESS=admin,auditor,editor

## Administration

Open https://`your_app_name`.mybluemix.net/admin.jsp

Please login with initial administrator account:
- User id : `hulopadmin`
- Password: `please change password`

**Important:** Please change admin password NOW!

You also need to create new editor account.

## Setting Indoor Floor Map (Optional)

Create Attachment zip file with the following files:

- map/floormaps.json file
```
[
	{
		"id": "<id of floor map>",
		"image": "<url of floor plan image>",
		"floor": <floor number>,
		"origin_x": <origin x>,
		"origin_y": <origin y>,
		"width": <width of image>,
		"height": <height of image>,
		"ppm_x": <pixels per meter x>,
		"ppm_y": <pixels per meter y>,
		"lat": <latitude>,
		"lng": <longitude>,
		"rotate": <rotate angle>
	},

	{
	    ...
	},

	{
	    ...
	}
]
```

- floor plan image files.

Import Attachment zip file using Administration console

## Edit Network Route

Open https://`your_app_name`.mybluemix.net/editor.jsp

Please login with editor account.

## Testing Navigation

Use https://`your_app_name`.mybluemix.net/mobile.jsp?id=`your_unique_device_id`

## Setting OpenLayers Tile Map Service

Open Street Map (OSM) is used for Tile Map Service by default. You can OSM for initial test.

However, heavy use of OSM is prohibited. See https://operations.osmfoundation.org/policies/tiles/

You need to provide your Tile Map Service via Environment Variable as follows:

HULOP\_TILE\_SERVER
- URL of tile service.
- Example: `https://{a-c}.tile.example.com/{z}/{x}/{y}.png?apikey=your_api_key`

HULOP\_TILE\_ATTR
- Attribution information.
- Example: `Maps © <a href="http://www.example.com">Example</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>`

## Setting Optional Environment Variables
ENABLE\_MAP\_ACCESS=admin,auditor,editor (no default)
- access right for map DB

SUPPORT\_AGREEMENT=true (default: false)
- agreement is supported at initial use

SUPPORT\_QUESTION=true (default: false)
- question is supported at initial use

EDITOR\_API\_KEY=key (no default)
- API key for map edit API

AUDITOR\_API\_KEY=key (no default)
- API key for logging API

ESCALATOR\_WEIGHT=weight (default: 100)
- weight for escalator route

STAIR\_WEIGHT=weight (default: 300)
- weight for stair route

ELEVATOR\_WEIGHT=weight (default: 300)
- weight for elavator route

MAX\_START\_PARAMS=count (default: 10000)
- max cache count for user location

MAX\_ROUTE\_BEANS=count (default: 1000)
- max cache count for route data

HULOP\_VCAP\_SERVICES=json (default: VCAP\_SERVICE json)
- use alternative db credential

COS\_SERVICES=json (default: VCAP\_SERVICE json)
- use alternative Cloud Object Storage credential

COS\_SETTINGS={"bucket_name": backet name, "endpoint_url": endpoint url, "location": location} (no default)
- specify Cloud Object Storage bucket

HULOP\_NAVI\_DB=name (default: navi_db)
- db name for MongoDB

HULOP\_INITIAL\_LOCATION={ "lat": latitude, "lng": longitude, "floor":floor } (default: COREDO Muromachi, no floor)
- initial map location

HULOP\_INITIAL\_ZOOM=zoom (default: 19.5)
- initial map zoom

HULOP\_MAX\_RADIUS=radius (default: 500)
- max radius for loading route data

HULOP\_DEFAULT\_SHOW\_LABELS\_ZOOMLEVEL=level (no default)
- show facility name when map zoom level >= level

HULOP\_INITIAL\_ROTATION\_MODE=mode (default: 1)
- initial map rotation mode (0: north up, 1: head up, 2: route up)

HULOP\_DO\_NOT\_USE\_SAVED\_CENTER=true (default: false)
- do not restore last map location

HULOP\_SCREEN\_FILTER\_SPEED=meter per second (no default)
- walking speed to apply screen filter

HULOP\_SCREEN\_FILTER\_START\_TIMER=second (no default)
- seconds before start screen filter

HULOP\_SCREEN\_FILTER\_STOP\_TIMER=second (default: start / 2)
- seconds before stop screen filter

HULOP\_SCREEN\_FILTER\_NO\_BUTTON=true (default: false)
- do not show screen filter disable button

ACCEPT\_IP\_ADDRESS=Regular expression (no default)
- Allow administration access only from certain IP Address

SERVICE\_TIME\_DIFF=UTC time offset in minutes (no default)
- set this value to apply service limitation date and time on route search


text:
using System;
using System.Collections.Generic;
using System.Reflection;

namespace MongoDB.Configuration.Mapping.Auto
{
    /// <summary>
    ///
    /// </summary>
    public class DefaultMemberFinder : IMemberFinder
    {
        ///<summary>
        ///</summary>
        public static readonly DefaultMemberFinder Instance = new DefaultMemberFinder();

        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultMemberFinder"/> class.
        /// </summary>
        private DefaultMemberFinder()
        {
        }

        /// <summary>
        /// Finds the members.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public IEnumerable<MemberInfo> FindMembers(Type type)
        {
            foreach (var prop in type.GetProperties(BindingFlags.Instance|BindingFlags.NonPublic|BindingFlags.Public))
            {
                var getMethod = prop.GetGetMethod(true);
                var setMethod = prop.GetSetMethod(true);

                if(getMethod==null || getMethod.IsPrivate || setMethod==null)
                    continue;

                if (setMethod.GetParameters().Length != 1) //an indexer
                    continue;

                yield return prop;
            }

            foreach (var field in type.GetFields()) //all public fields
            {
                if (!field.IsInitOnly && !field.IsLiteral) //readonly
                    yield return field;
            }
        }
    }
}


text:
"""Deletes an SSL certificate for a Cloud SQL instance."""

from googlecloudsdk.api_lib.sql import cert
from googlecloudsdk.api_lib.sql import operations
from googlecloudsdk.api_lib.sql import validate
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.sql import flags
from googlecloudsdk.core import log
from googlecloudsdk.core.console import console_io

class _BaseDelete(object):
  """Base class for sql ssl_certs delete."""

  @staticmethod
  def Args(parser):
    """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    """
    base.ASYNC_FLAG.AddToParser(parser)
    parser.add_argument(
        'common_name',
        help='User supplied name. Constrained to ```[a-zA-Z.-_ ]+```.')
    flags.INSTANCE_FLAG.AddToParser(parser)

@base.ReleaseTracks(base.ReleaseTrack.GA)
class Delete(_BaseDelete, base.Command):
  """Deletes an SSL certificate for a Cloud SQL instance."""

  def Run(self, args):
    """Deletes an SSL certificate for a Cloud SQL instance.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object representing the operations resource describing the delete
      operation if the api request was successful.
    Raises:
      HttpException: A http error response was received while executing api
          request.
      ToolException: An error other than http error occured while executing the
          command.
    """
    sql_client = self.context['sql_client']
    sql_messages = self.context['sql_messages']
    resources = self.context['registry']

    validate.ValidateInstanceName(args.instance)
    instance_ref = resources.Parse(args.instance, collection='sql.instances')

    # TODO(user): figure out how to rectify the common_name and the
    # sha1fingerprint, so that things can work with the resource parser.

    console_io.PromptContinue(
        message='{0} will be deleted. New connections can no longer be made '
        'using this certificate. Existing connections are not affected.'.format(
            args.common_name),
        default=True,
        cancel_on_no=True)

    cert_ref = cert.GetCertRefFromName(sql_client, sql_messages, resources,
                                       instance_ref, args.common_name)
    if not cert_ref:
      raise exceptions.ToolException(
          'no ssl cert named [{name}] for instance [{instance}]'.format(
              name=args.common_name,
              instance=instance_ref))

    result = sql_client.sslCerts.Delete(
        sql_messages.SqlSslCertsDeleteRequest(
            project=cert_ref.project,
            instance=cert_ref.instance,
            sha1Fingerprint=cert_ref.sha1Fingerprint))

    operation_ref = resources.Create(
        'sql.operations',
        operation=result.operation,
        project=cert_ref.project,
        instance=cert_ref.instance,
    )

    if args.async:
      return sql_client.operations.Get(
          sql_messages.SqlOperationsGetRequest(
              project=operation_ref.project,
              instance=operation_ref.instance,
              operation=operation_ref.operation))

    operations.OperationsV1Beta3.WaitForOperation(
        sql_client, operation_ref, 'Deleting sslCert')

    log.DeletedResource(cert_ref)

@base.ReleaseTracks(base.ReleaseTrack.BETA)
class DeleteBeta(_BaseDelete, base.Command):
  """Deletes an SSL certificate for a Cloud SQL instance."""

  def Run(self, args):
    """Deletes an SSL certificate for a Cloud SQL instance.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object representing the operations resource describing the delete
      operation if the api request was successful.
    Raises:
      HttpException: A http error response was received while executing api
          request.
      ToolException: An error other than http error occured while executing the
          command.
    """
    sql_client = self.context['sql_client']
    sql_messages = self.context['sql_messages']
    resources = self.context['registry']

    validate.ValidateInstanceName(args.instance)
    instance_ref = resources.Parse(args.instance, collection='sql.instances')

    # TODO(user): figure out how to rectify the common_name and the
    # sha1fingerprint, so that things can work with the resource parser.

    console_io.PromptContinue(
        message='{0} will be deleted. New connections can no longer be made '
        'using this certificate. Existing connections are not affected.'.format(
            args.common_name),
        default=True,
        cancel_on_no=True)

    cert_ref = cert.GetCertRefFromName(sql_client, sql_messages, resources,
                                       instance_ref, args.common_name)
    if not cert_ref:
      raise exceptions.ToolException(
          'no ssl cert named [{name}] for instance [{instance}]'.format(
              name=args.common_name,
              instance=instance_ref))

    result = sql_client.sslCerts.Delete(
        sql_messages.SqlSslCertsDeleteRequest(
            project=cert_ref.project,
            instance=cert_ref.instance,
            sha1Fingerprint=cert_ref.sha1Fingerprint))

    operation_ref = resources.Create(
        'sql.operations',
        operation=result.name,
        project=cert_ref.project,
        instance=cert_ref.instance,
    )

    if args.async:
      return sql_client.operations.Get(
          sql_messages.SqlOperationsGetRequest(
              project=operation_ref.project,
              instance=operation_ref.instance,
              operation=operation_ref.operation))

    operations.OperationsV1Beta4.WaitForOperation(
        sql_client, operation_ref, 'Deleting sslCert')

    log.DeletedResource(cert_ref)


text:
#pragma warning(disable:4305)
#pragma warning(disable:4244)

#include "CaelumPrecompiled.h"
#include "CaelumSystem.h"
#include "CaelumExceptions.h"
#include "InternalUtilities.h"
#include "Astronomy.h"
#include "CaelumPlugin.h"
#include "FlatCloudLayer.h"

using namespace Ogre;

namespace Caelum
{
    const String CaelumSystem::DEFAULT_SKY_GRADIENTS_IMAGE = "EarthClearSky2.png";
    const String CaelumSystem::DEFAULT_SUN_COLOURS_IMAGE = "SunGradient.png";

    CaelumSystem::CaelumSystem
    (
        Ogre::Root *root,
        Ogre::SceneManager *sceneMgr,
        CaelumComponent componentsToCreate/* = CAELUM_COMPONENTS_DEFAULT*/
    ):
        mOgreRoot (root),
        mSceneMgr (sceneMgr),
        mCleanup (false)
    {
        LogManager::getSingleton().logMessage ("Caelum: Initialising Caelum system...");
        //LogManager::getSingleton().logMessage ("Caelum: CaelumSystem* at d" +
        //        StringConverter::toString (reinterpret_cast<uint>(this)));

        Ogre::String uniqueId = Ogre::StringConverter::toString ((size_t)this);
        if (!CaelumPlugin::getSingletonPtr ()) {
            LogManager::getSingleton().logMessage ("Caelum: Plugin not installed; installing now.");
            new CaelumPlugin ();
            CaelumPlugin::getSingletonPtr ()->install ();
            CaelumPlugin::getSingletonPtr ()->initialise ();
        }

        mCaelumCameraNode.reset(mSceneMgr->getRootSceneNode ()->createChildSceneNode ("Caelum/CameraNode/" + uniqueId));
        mCaelumGroundNode.reset(mSceneMgr->getRootSceneNode ()->createChildSceneNode ("Caelum/GroundNode/" + uniqueId));
        mUniversalClock.reset(new UniversalClock ());

        // If the "Caelum" resource group does not exist; create it.
        // This resource group is never released; which may be bad.
        // What does ogre do for it's own runtime resources?
        Ogre::StringVector groups = ResourceGroupManager::getSingleton ().getResourceGroups ();
        if (std::find (groups.begin(), groups.end(), Caelum::RESOURCE_GROUP_NAME) == groups.end()) {
            LogManager::getSingleton ().logMessage (
                    "Caelum: Creating required internal resource group \'" + RESOURCE_GROUP_NAME + "\'");
            ResourceGroupManager::getSingleton ().createResourceGroup (Caelum::RESOURCE_GROUP_NAME);
        }

        // Autoconfigure. Calls clear first to set defaults.
        autoConfigure (componentsToCreate);
    }

    void CaelumSystem::destroySubcomponents (bool destroyEverything)
    {
        // Destroy sub-components
        setSkyDome (0);
        setSun (0);
        setImageStarfield (0);
        setPointStarfield (0);
        setCloudSystem (0);
        setPrecipitationController (0);
        setDepthComposer (0);
        setGroundFog (0);
        setMoon (0);
        mSkyGradientsImage.reset ();
        mSunColoursImage.reset ();

        // These things can't be rebuilt.
        if (destroyEverything) {
            LogManager::getSingleton ().logMessage("Caelum: Delete UniversalClock");
            mUniversalClock.reset ();
            mCaelumCameraNode.reset ();
            mCaelumGroundNode.reset ();
        }
    }

    CaelumSystem::~CaelumSystem () {
        destroySubcomponents (true);
        LogManager::getSingleton ().logMessage ("Caelum: CaelumSystem destroyed.");
    }

    void CaelumSystem::clear()
    {
        // Destroy all subcomponents first.
        destroySubcomponents (false);

        // Some "magical" behaviour.
        mAutoMoveCameraNode = true;
        mAutoNotifyCameraChanged = true;
        mAutoAttachViewportsToComponents = true;
        mAutoViewportBackground = true;

        // Default lookups.
        setSkyGradientsImage(DEFAULT_SKY_GRADIENTS_IMAGE);
        setSunColoursImage(DEFAULT_SUN_COLOURS_IMAGE);

        // Fog defaults.
        setManageSceneFog (true);
        mGlobalFogDensityMultiplier = 1;
        mGlobalFogColourMultiplier = Ogre::ColourValue(1.0, 1.0, 1.0, 1.0);
        mSceneFogDensityMultiplier = 1;
        mSceneFogColourMultiplier = Ogre::ColourValue(0.7, 0.7, 0.7, 0.7);
        mGroundFogDensityMultiplier = 1;
        mGroundFogColourMultiplier = Ogre::ColourValue(1.0, 1.0, 1.0, 1.0);

        // Ambient lighting.
        setManageAmbientLight (true);
        setMinimumAmbientLight (Ogre::ColourValue (0.1, 0.1, 0.3));
        mEnsureSingleLightSource = false;
        mEnsureSingleShadowSource = false;

        // Observer time & position. J2000 is midday.
        mObserverLatitude = Ogre::Degree(45);
        mObserverLongitude = Ogre::Degree(0);
        mUniversalClock->setJulianDay (Astronomy::J2000);
    }

    void CaelumSystem::autoConfigure
    (
        CaelumComponent componentsToCreate/* = CAELUM_COMPONENTS_DEFAULT*/
    )
    {
        // Clear everything; revert to default.
        clear();

        if (componentsToCreate == 0) {
            // Nothing to do. Don't print junk if not creating anything.
            return;
        }
        LogManager::getSingleton ().logMessage ("Caelum: Creating caelum sub-components.");

        // Init skydome
        if (componentsToCreate & CAELUM_COMPONENT_SKY_DOME) {
            try {
                this->setSkyDome (new SkyDome (mSceneMgr, getCaelumCameraNode ()));
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize skydome: " + ex.getFullDescription());
            }
        }

        // Init sun
        if (componentsToCreate & CAELUM_COMPONENT_SUN) {
            try {
                this->setSun (new SpriteSun (mSceneMgr, getCaelumCameraNode ()));
                this->getSun ()->setAmbientMultiplier (Ogre::ColourValue (0.5, 0.5, 0.5));
                this->getSun ()->setDiffuseMultiplier (Ogre::ColourValue (3, 3, 2.7));
                this->getSun ()->setSpecularMultiplier (Ogre::ColourValue (5, 5, 5));

                this->getSun ()->setAutoDisable (true);
                this->getSun ()->setAutoDisableThreshold (0.05);
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize sun: " + ex.getFullDescription());
            }
        }

        // Init moon
        if (componentsToCreate & CAELUM_COMPONENT_MOON) {
            try {
                this->setMoon (new Moon (mSceneMgr, getCaelumCameraNode ()));
                this->getMoon ()->setAutoDisable (true);
                this->getMoon ()->setAutoDisableThreshold (0.05);
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize moon: " + ex.getFullDescription());
            }
        }
        if (componentsToCreate & CAELUM_COMPONENT_IMAGE_STARFIELD) {
            try {
                this->setImageStarfield (new ImageStarfield (mSceneMgr, getCaelumCameraNode ()));
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize the old image starfield: " + ex.getFullDescription());
            }
        }
        if (componentsToCreate & CAELUM_COMPONENT_POINT_STARFIELD) {
            try {
                this->setPointStarfield (new PointStarfield (mSceneMgr, getCaelumCameraNode ()));
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize starfield: " + ex.getFullDescription());
            }
        }
        if (componentsToCreate & CAELUM_COMPONENT_GROUND_FOG) {
            try {
               this->setGroundFog (new GroundFog (mSceneMgr, getCaelumCameraNode ()));
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize ground fog: " + ex.getFullDescription());
            }
        }
        if (componentsToCreate & CAELUM_COMPONENT_CLOUDS) {
            try {
			    this->setCloudSystem (new CloudSystem (mSceneMgr, getCaelumGroundNode ()));
                getCloudSystem ()->createLayerAtHeight (3000);
                getCloudSystem ()->getLayer (0)->setCloudCover (0.3);
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize clouds: " + ex.getFullDescription());
            }
        }
        if (componentsToCreate & CAELUM_COMPONENT_PRECIPITATION) {
            try {
                this->setPrecipitationController (new PrecipitationController (mSceneMgr));
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize precipitation: " + ex.getFullDescription());
            }
        }
        if (componentsToCreate & CAELUM_COMPONENT_SCREEN_SPACE_FOG) {
            try {
                this->setDepthComposer (new DepthComposer (mSceneMgr));
            } catch (Caelum::UnsupportedException& ex) {
                LogManager::getSingleton ().logMessage (
                        "Caelum: Failed to initialize precipitation: " + ex.getFullDescription());
            }
        }

        LogManager::getSingleton ().logMessage ("Caelum: DONE initializing");
    }

    void CaelumSystem::shutdown (const bool cleanup) {
        LogManager::getSingleton ().logMessage ("Caelum: Shutting down Caelum system...");

        destroySubcomponents (true);

        if (cleanup) {
            mOgreRoot->removeFrameListener (this);
            delete this;
        } else {
            // We'll delete later. Make sure we're registered as a frame listener, or we'd leak.
            mOgreRoot->addFrameListener(this);
            mCleanup = true;
        }
    }

    void CaelumSystem::attachViewportImpl (Ogre::Viewport* vp)
    {
        LogManager::getSingleton().getDefaultLog ()->logMessage (
                "CaelumSystem: Attached to"
                " viewport " + StringConverter::toString ((long)vp) +
                " render target " + vp->getTarget ()->getName ());
        if (getAutoAttachViewportsToComponents ()) {
            if (getPrecipitationController ()) {
                getPrecipitationController ()->createViewportInstance (vp);
            }
            if (getDepthComposer ()) {
                getDepthComposer ()->createViewportInstance (vp);
            }
        }
    }

    void CaelumSystem::detachViewportImpl (Ogre::Viewport* vp)
    {
        LogManager::getSingleton().getDefaultLog ()->logMessage (
                "CaelumSystem: Detached from "
                " viewport " + StringConverter::toString ((long)vp) +
                " render target " + vp->getTarget ()->getName ());
        if (getAutoAttachViewportsToComponents ()) {
            if (getPrecipitationController ()) {
                getPrecipitationController ()->destroyViewportInstance (vp);
            }
            if (getDepthComposer ()) {
                getDepthComposer ()->destroyViewportInstance (vp);
            }
        }
    }

    void CaelumSystem::attachViewport (Ogre::Viewport* vp)
    {
        bool found = !mAttachedViewports.insert (vp).second;
        if (!found) {
            attachViewportImpl (vp);
        }
    }

    void CaelumSystem::detachViewport (Ogre::Viewport* vp)
    {
        std::set<Viewport*>::size_type erase_result = mAttachedViewports.erase(vp);
        assert(erase_result == 0 || erase_result == 1);
        bool found = erase_result == 1;
        if (found) {
            detachViewportImpl (vp);
        }
    }

    void CaelumSystem::detachAllViewports ()
    {
        std::set<Viewport*>::const_iterator it = mAttachedViewports.begin(), end = mAttachedViewports.end();
        for (; it != end; ++it) {
            detachViewportImpl (*it);
        }
        mAttachedViewports.clear();
    }

    bool CaelumSystem::isViewportAttached (Ogre::Viewport* vp) const {
        return mAttachedViewports.find (vp) != mAttachedViewports.end();
    }

    void CaelumSystem::setSkyDome (SkyDome *obj) {
        mSkyDome.reset (obj);
    }

    void CaelumSystem::setSun (BaseSkyLight* obj) {
        mSun.reset (obj);
    }

    void CaelumSystem::setMoon (Moon* obj) {
        mMoon.reset (obj);
    }

    void CaelumSystem::setImageStarfield (ImageStarfield* obj) {
        mImageStarfield.reset (obj);
    }

    void CaelumSystem::setPointStarfield (PointStarfield* obj) {
        mPointStarfield.reset (obj);
    }

    void CaelumSystem::setGroundFog (GroundFog* obj) {
        mGroundFog.reset (obj);
    }

    void CaelumSystem::setCloudSystem (CloudSystem* obj) {
        mCloudSystem.reset (obj);
    }

    void CaelumSystem::setPrecipitationController (PrecipitationController* newptr) {
        PrecipitationController* oldptr = getPrecipitationController ();
        if (oldptr == newptr) {
            return;
        }
        // Detach old
        if (getAutoAttachViewportsToComponents() && oldptr) {
            std::for_each (mAttachedViewports.begin(), mAttachedViewports.end(),
                    std::bind1st (std::mem_fun (&PrecipitationController::destroyViewportInstance), oldptr));
        }
        // Attach new.
        if (getAutoAttachViewportsToComponents() && newptr) {
            std::for_each (mAttachedViewports.begin(), mAttachedViewports.end(),
                    std::bind1st (std::mem_fun (&PrecipitationController::createViewportInstance), newptr));
        }
        mPrecipitationController.reset(newptr);
    }

    void CaelumSystem::setDepthComposer (DepthComposer* ptr) {
        mDepthComposer.reset(ptr);
        if (getAutoAttachViewportsToComponents() && getDepthComposer ()) {
            std::for_each (
                    mAttachedViewports.begin(), mAttachedViewports.end(),
                    std::bind1st (
                            std::mem_fun (&DepthComposer::createViewportInstance),
                            getDepthComposer ()));
        }
    }

    void CaelumSystem::preViewportUpdate (const Ogre::RenderTargetViewportEvent &e) {
        Ogre::Viewport *viewport = e.source;
        Ogre::Camera *camera = viewport->getCamera ();

        if (getAutoViewportBackground ()) {
            viewport->setBackgroundColour (Ogre::ColourValue::Black);
        }
        if (getAutoNotifyCameraChanged ()) {
            this->notifyCameraChanged (camera);
        }
    }

    void CaelumSystem::notifyCameraChanged(Ogre::Camera* cam)
    {
        // Move camera node.
        if (getAutoMoveCameraNode ()) {
            mCaelumCameraNode->setPosition (cam->getDerivedPosition());
            mCaelumCameraNode->_update (true, true);
        }

        if (getSkyDome ()) {
            getSkyDome ()->notifyCameraChanged (cam);
        }

        if (getSun ()) {
            getSun ()->notifyCameraChanged (cam);
        }

        if (getMoon ()) {
            getMoon ()->notifyCameraChanged (cam);
        }

        if (getImageStarfield ()) {
            getImageStarfield ()->notifyCameraChanged (cam);
        }

        if (getPointStarfield ()) {
            getPointStarfield ()->notifyCameraChanged (cam);
        }

        if (getGroundFog ()) {
            getGroundFog ()->notifyCameraChanged (cam);
        }
    }

    bool CaelumSystem::frameStarted (const Ogre::FrameEvent &e) {
        if (mCleanup) {
            // Delayed destruction.
            mOgreRoot->removeFrameListener (this);
            delete this;
            return true;
        }

        updateSubcomponents(e.timeSinceLastFrame);

        return true;
    }

    void CaelumSystem::updateSubcomponents (Real timeSinceLastFrame)
    {
        /*
        LogManager::getSingleton().getDefaultLog()->logMessage(
                "CaelumSystem::updateSubcomponents: " +
                StringConverter::toString (timeSinceLastFrame, 10));
        */

        mUniversalClock->update (timeSinceLastFrame);

        // Timing variables
        LongReal julDay = mUniversalClock->getJulianDay ();
        LongReal relDayTime = fmod(julDay, 1);
        Real secondDiff = timeSinceLastFrame * mUniversalClock->getTimeScale ();

        // Get astronomical parameters.
        Ogre::Vector3 sunDir = getSunDirection(julDay);
        Ogre::Vector3 moonDir = getMoonDirection(julDay);
        Real moonPhase = getMoonPhase(julDay);

        // Get parameters from sky colour model.
        Real fogDensity = getFogDensity (relDayTime, sunDir);
        Ogre::ColourValue fogColour = getFogColour (relDayTime, sunDir);
        Ogre::ColourValue sunLightColour = getSunLightColour (relDayTime, sunDir);
        Ogre::ColourValue sunSphereColour = getSunSphereColour (relDayTime, sunDir);
        Ogre::ColourValue moonLightColour = getMoonLightColour (moonDir);
        Ogre::ColourValue moonBodyColour = getMoonBodyColour (moonDir);

        fogDensity *= mGlobalFogDensityMultiplier;
        fogColour = fogColour * mGlobalFogColourMultiplier;

        // Update image starfield
        if (getImageStarfield ()) {
            getImageStarfield ()->update (relDayTime);
            getImageStarfield ()->setInclination (-getObserverLatitude ());
        }

        // Update point starfield
        if (getPointStarfield ()) {
            getPointStarfield ()->setObserverLatitude (getObserverLatitude ());
            getPointStarfield ()->setObserverLongitude (getObserverLongitude ());
            getPointStarfield ()->_update (relDayTime);
        }

        // Update skydome.
        if (getSkyDome ()) {
            getSkyDome ()->setSunDirection (sunDir);
            getSkyDome ()->setHazeColour (fogColour * mSceneFogColourMultiplier);
        }

        // Update scene fog.
        if (getManageSceneFog ()) {
            mSceneMgr->setFog (Ogre::FOG_EXP2,
                    fogColour * mSceneFogColourMultiplier,
                    fogDensity * mSceneFogDensityMultiplier);
        }

        // Update ground fog.
        if (getGroundFog ()) {
            getGroundFog ()->setColour (fogColour * mGroundFogColourMultiplier);
            getGroundFog ()->setDensity (fogDensity * mGroundFogDensityMultiplier);
        }

        // Update sun
        if (getSun ()) {
            mSun->update (sunDir, sunLightColour, sunSphereColour);
        }

        // Update moon.
        if (getMoon ()) {
            mMoon->update (
                    moonDir,
                    moonLightColour,
                    moonBodyColour);
            mMoon->setPhase (moonPhase);
        }

        // Update clouds
        if (getCloudSystem ()) {
            getCloudSystem ()->update (
                    secondDiff, sunDir, sunLightColour, fogColour, sunSphereColour);
        }

        // Update precipitation
        if (getPrecipitationController ()) {
            getPrecipitationController ()->update (secondDiff, fogColour);
        }

        // Update screen space fog
        if (getDepthComposer ()) {
            getDepthComposer ()->update ();
            getDepthComposer ()->setSunDirection (sunDir);
            getDepthComposer ()->setHazeColour (fogColour);
            getDepthComposer ()->setGroundFogColour (fogColour * mGroundFogColourMultiplier);
            getDepthComposer ()->setGroundFogDensity (fogDensity * mGroundFogDensityMultiplier);
        }

        // Update ambient lighting.
        if (getManageAmbientLight ()) {
            Ogre::ColourValue ambient = Ogre::ColourValue::Black;
            if (getMoon ()) {
                ambient += getMoon ()->getLightColour () * getMoon ()->getAmbientMultiplier ();
            }
            if (getSun ()) {
                ambient += getSun ()->getLightColour () * getSun ()->getAmbientMultiplier ();
            }
            ambient.r = std::max(ambient.r, mMinimumAmbientLight.r);
            ambient.g = std::max(ambient.g, mMinimumAmbientLight.g);
            ambient.b = std::max(ambient.b, mMinimumAmbientLight.b);
            ambient.a = std::max(ambient.a, mMinimumAmbientLight.a);
            // Debug ambient factos (ick).
            /*
            LogManager::getSingleton().logMessage (
                        "Sun is " + StringConverter::toString(sunLightColour) + "\n"
                        "Moon is " + StringConverter::toString(moonLightColour) + "\n"
                        "Ambient is " + StringConverter::toString(ambient) + "\n"
                        );
             */
            mSceneMgr->setAmbientLight (ambient);
        }

        if (getSun() && getMoon ()) {
            Ogre::Real moonBrightness = moonLightColour.r + moonLightColour.g + moonLightColour.b + moonLightColour.a;
            Ogre::Real sunBrightness = sunLightColour.r + sunLightColour.g + sunLightColour.b + sunLightColour.a;
            bool sunBrighterThanMoon = (sunBrightness > moonBrightness);

            if (getEnsureSingleLightSource ()) {
                getMoon ()->setForceDisable (sunBrighterThanMoon);
                getSun ()->setForceDisable (!sunBrighterThanMoon);
            }
            if (getEnsureSingleShadowSource ()) {
                getMoon ()->getMainLight ()->setCastShadows (!sunBrighterThanMoon);
                getSun ()->getMainLight ()->setCastShadows (sunBrighterThanMoon);
            }
        }
    }

    void CaelumSystem::setManageSceneFog (bool value) {
        mManageSceneFog = value;
        // Prevent having some stale values around.
        if (!value) {
            mSceneMgr->setFog (Ogre::FOG_NONE);
        }
    }

    bool CaelumSystem::getManageSceneFog () const {
        return mManageSceneFog;
    }

    void CaelumSystem::setSceneFogDensityMultiplier (Real value) {
        mSceneFogDensityMultiplier = value;
    }

    Real CaelumSystem::getSceneFogDensityMultiplier () const {
        return mSceneFogDensityMultiplier;
    }

    void CaelumSystem::setGroundFogDensityMultiplier (Real value) {
        mGroundFogDensityMultiplier = value;
    }

    Real CaelumSystem::getGroundFogDensityMultiplier () const {
        return mGroundFogDensityMultiplier;
    }

    void CaelumSystem::setGlobalFogDensityMultiplier (Real value) {
        mGlobalFogDensityMultiplier = value;
    }

    Real CaelumSystem::getGlobalFogDensityMultiplier () const {
        return mGlobalFogDensityMultiplier;
    }

    void CaelumSystem::setSkyGradientsImage (const Ogre::String &filename) {
        mSkyGradientsImage.reset(new Ogre::Image ());
        mSkyGradientsImage->load (filename, RESOURCE_GROUP_NAME);
    }

    void CaelumSystem::setSunColoursImage (const Ogre::String &filename) {
        mSunColoursImage.reset(new Ogre::Image ());
        mSunColoursImage->load (filename, RESOURCE_GROUP_NAME);
    }

    Ogre::ColourValue CaelumSystem::getFogColour (Real time, const Ogre::Vector3 &sunDir) {
        if (!mSkyGradientsImage.get()) {
            return Ogre::ColourValue::Black;
        }

        Real elevation = sunDir.dotProduct (Ogre::Vector3::UNIT_Y) * 0.5 + 0.5;
        Ogre::ColourValue col = InternalUtilities::getInterpolatedColour (elevation, 1, mSkyGradientsImage.get(), false);
        return col;
    }

    Real CaelumSystem::getFogDensity (Real time, const Ogre::Vector3 &sunDir)
    {
        if (!mSkyGradientsImage.get()) {
            return 0;
        }

        Real elevation = sunDir.dotProduct (Ogre::Vector3::UNIT_Y) * 0.5 + 0.5;
        Ogre::ColourValue col = InternalUtilities::getInterpolatedColour (elevation, 1, mSkyGradientsImage.get(), false);
        return col.a;
    }

    Ogre::ColourValue CaelumSystem::getSunSphereColour (Real time, const Ogre::Vector3 &sunDir)
    {
        if (!mSunColoursImage.get()) {
            return Ogre::ColourValue::White;
        }

        Real elevation = sunDir.dotProduct (Ogre::Vector3::UNIT_Y);
        elevation = elevation * 2 + 0.4;
        return InternalUtilities::getInterpolatedColour (elevation, 1, mSunColoursImage.get(), false);
    }

    Ogre::ColourValue CaelumSystem::getSunLightColour (Real time, const Ogre::Vector3 &sunDir)
    {
        if (!mSkyGradientsImage.get()) {
            exit(-1);
            return Ogre::ColourValue::White;
        }
        Real elevation = sunDir.dotProduct (Ogre::Vector3::UNIT_Y) * 0.5 + 0.5;

        // Hack: return averaged sky colours.
        // Don't use an alpha value for lights, this can cause nasty problems.
        Ogre::ColourValue col = InternalUtilities::getInterpolatedColour (elevation, elevation, mSkyGradientsImage.get(), false);
        Real val = (col.r + col.g + col.b) / 3;
        col = Ogre::ColourValue(val, val, val, 1.0);
        assert(Ogre::Math::RealEqual(col.a, 1));
        return col;
    }

    Ogre::ColourValue CaelumSystem::getMoonBodyColour (const Ogre::Vector3 &moonDir) {
        return Ogre::ColourValue::White;
    }

    Ogre::ColourValue CaelumSystem::getMoonLightColour (const Ogre::Vector3 &moonDir)
    {
        if (!mSkyGradientsImage.get()) {
            return Ogre::ColourValue::Blue;
        }
        // Scaled version of getSunLightColor
        Real elevation = moonDir.dotProduct (Ogre::Vector3::UNIT_Y) * 0.5 + 0.5;
        Ogre::ColourValue col = InternalUtilities::getInterpolatedColour (elevation, elevation, mSkyGradientsImage.get(), false);
        Real val = (col.r + col.g + col.b) / 3;
        col = Ogre::ColourValue(val / 2.5f, val / 2.5f, val / 2.5f, 1.0);
        assert(Ogre::Math::RealEqual(col.a, 1));
        return col;
    }

    const Ogre::Vector3 CaelumSystem::makeDirection (
            Ogre::Degree azimuth, Ogre::Degree altitude)
    {
        Ogre::Vector3 res;
        res.z = -Ogre::Math::Cos (azimuth) * Ogre::Math::Cos (altitude);  // North
        res.x =  Ogre::Math::Sin (azimuth) * Ogre::Math::Cos (altitude);  // East
        res.y = -Ogre::Math::Sin (altitude); // Zenith
        return res;
    }

    const Ogre::Vector3 CaelumSystem::getSunDirection (LongReal jday)
    {
        Ogre::Degree azimuth, altitude;
        {
            ScopedHighPrecissionFloatSwitch precissionSwitch;

		    Astronomy::getHorizontalSunPosition(jday,
                    getObserverLongitude(), getObserverLatitude(),
                    azimuth, altitude);
        }
        Ogre::Vector3 res = makeDirection(azimuth, altitude);

        return res;
    }

	const Ogre::Vector3 CaelumSystem::getMoonDirection (LongReal jday)
    {
        Ogre::Degree azimuth, altitude;
        {
            ScopedHighPrecissionFloatSwitch precissionSwitch;

            Astronomy::getHorizontalMoonPosition(jday,
                    getObserverLongitude (), getObserverLatitude (),
                    azimuth, altitude);
        }
        Ogre::Vector3 res = makeDirection(azimuth, altitude);

		return res;
	}

    const Ogre::Real CaelumSystem::getMoonPhase (LongReal jday)
    {
        // Calculates julian days since January 22, 2008 13:36 (full moon)
        // and divides by the time between lunations (synodic month)
        LongReal T = (jday - 2454488.0665L) / 29.531026L;

        T = fabs(fmod(T, 1));
        return -fabs(-4 * T + 2) + 2;
    }

    void CaelumSystem::forceSubcomponentQueryFlags (uint flags)
    {
        if (getSkyDome ()) getSkyDome ()->setQueryFlags (flags);
        if (getSun ()) getSun ()->setQueryFlags (flags);
        if (getMoon ()) getMoon ()->setQueryFlags (flags);
        if (getImageStarfield ()) getImageStarfield ()->setQueryFlags (flags);
        if (getPointStarfield ()) getPointStarfield ()->setQueryFlags (flags);
        if (getGroundFog ()) getGroundFog ()->setQueryFlags (flags);
        if (getCloudSystem ()) getCloudSystem ()->forceLayerQueryFlags (flags);
    }

    void CaelumSystem::forceSubcomponentVisibilityFlags (uint flags)
    {
        if (getSkyDome ()) getSkyDome ()->setVisibilityFlags (flags);
        if (getSun ()) getSun ()->setVisibilityFlags (flags);
        if (getMoon ()) getMoon ()->setVisibilityFlags (flags);
        if (getImageStarfield ()) getImageStarfield ()->setVisibilityFlags (flags);
        if (getPointStarfield ()) getPointStarfield ()->setVisibilityFlags (flags);
        if (getGroundFog ()) getGroundFog ()->setVisibilityFlags (flags);
        if (getCloudSystem ()) getCloudSystem ()->forceLayerVisibilityFlags (flags);
    }
}


text:
require 'ffaker/address'

module FFaker
  module AddressIN
    include FFaker::Address

    extend ModuleUtils
    extend self

    ZIP_FORMATS = ['######'].freeze

    def pincode
      FFaker.numerify ZIP_FORMATS.sample
    end

    alias zip_code pincode

    def state
      STATE.sample
    end

    def state_abbr
      STATE_ABBR.sample
    end

    def union_territory
      UNION_TERRITORY.sample
    end

    def union_territory_abbr
      UNION_TERRITORY_ABBR.sample
    end

    def state_and_union_territory
      (STATE + UNION_TERRITORY).sample
    end

    def state_and_union_territory_abbr
      (STATE_ABBR + UNION_TERRITORY_ABBR).sample
    end

    def country
      FFaker::Address.country('IN')
    end

    def country_code
      FFaker::Address.country_code('India')
    end

    def time_zone
      'Asia/Kolkata'
    end
  end
end


text:
namespace CommonTestConsole
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Linq;
    using Common.Collections.Generic;

    class Program
    {
        static void Main(string[] args)
        {
            Random rng = new Random();
            using (StreamWriter file = new System.IO.StreamWriter(@"output.csv"))
            {
                TextWriter writer = Console.Out;
                //TextWriter writer = file;

                int maxN = 2000000;
                int minN = 1000000;
                int step = 200000;

                bool doDelete = false;
                bool doFind = false;

                int repititions = 3;

                int n = minN;
                while (n <= maxN)
                {
                    for (int j = 1; j <= repititions; ++j)
                    {
                        CompareCollections(rng, n, writer, doDelete, doFind);
                        Console.WriteLine("{0:hh:mm:ss} - Finished {1} - Iteration {2}", DateTime.Now, n, j);
                    }
                    n += step;
                }
            }
        }

        private static void CompareCollections(Random rng, int n, TextWriter file, bool doDelete, bool doFind)
        {
            int nFind = n / 10;

            int[] numbers = GetUniqueRandomNumbers(rng, n, 0, Int32.MaxValue);
            int[] randomIndexes = GetUniqueRandomNumbers(rng, nFind, 0, n);

            IDictionary<string, double> iterativeBstTimes = new Dictionary<string, double>();
            IDictionary<string, double> redBlackTimes = new Dictionary<string, double>();
            IDictionary<string, double> avlTimes = new Dictionary<string, double>();
            IDictionary<string, double> skipListTimes = new Dictionary<string, double>();

            ICollection<int> iterativeBst = new BinarySearchTree<int>();
            ICollection<int> redBlackTree = new RedBlackTree<int>();
            ICollection<int> avlTree = new AVLTree<int>();
            ICollection<int> skipList = new SkipList<int>();

            bool doIterative = true;
            bool doRedBlack = true;
            bool doAvl = true;
            bool doSkipList = false;

            if (doIterative)
                iterativeBstTimes["insert"] = BuildAndCheckCollection(iterativeBst, numbers);

            if (doRedBlack)
                redBlackTimes["insert"] = BuildAndCheckCollection(redBlackTree, numbers);

            if (doAvl)
                avlTimes["insert"] = BuildAndCheckCollection(avlTree, numbers);

            if (doSkipList)
                skipListTimes["insert"] = BuildAndCheckCollection(skipList, numbers);

            if (doFind)
            {
                if (doIterative)
                    iterativeBstTimes["find"] = FindValuesInCollection(iterativeBst, numbers, randomIndexes);

                if (doRedBlack)
                    redBlackTimes["find"] = FindValuesInCollection(redBlackTree, numbers, randomIndexes);

                if (doAvl)
                    avlTimes["find"] = FindValuesInCollection(avlTree, numbers, randomIndexes);

                if (doSkipList)
                    skipListTimes["find"] = FindValuesInCollection(skipList, numbers, randomIndexes);
            }

            if (doDelete)
            {
                if (doIterative)
                    iterativeBstTimes["delete"] = DeleteValuesInCollection(iterativeBst, numbers, randomIndexes);

                if (doRedBlack)
                    redBlackTimes["delete"] = DeleteValuesInCollection(redBlackTree, numbers, randomIndexes);

                if (doAvl)
                    avlTimes["delete"] = DeleteValuesInCollection(avlTree, numbers, randomIndexes);

                if (doSkipList)
                    skipListTimes["delete"] = DeleteValuesInCollection(skipList, numbers, randomIndexes);
            }

            file.Write("{0},", n);

            if (doIterative)
                WriteStats(iterativeBstTimes, file);

            if (doRedBlack)
                WriteStats(redBlackTimes, file);

            if (doAvl)
                WriteStats(avlTimes, file);

            if (doSkipList)
                WriteStats(skipListTimes, file);

            file.WriteLine();
        }

        private static void WriteStats(IDictionary<string, double> times, TextWriter file)
        {
            if (times.ContainsKey("insert"))
                file.Write("{0:F10},", times["insert"]);

            if (times.ContainsKey("delete"))
                file.Write("{0:F10},", times["delete"]);

            if (times.ContainsKey("find"))
                file.Write("{0:F10},", times["find"]);
        }

        private static double DeleteValuesInCollection(ICollection<int> collection, int[] numbers, int[] randomIndexes)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            TimeSpan time = new TimeSpan();
            for (int i = 0; i < randomIndexes.Count(); ++i)
            {
                stopwatch.Restart();
                collection.Remove(numbers[randomIndexes[i]]);
                time += stopwatch.Elapsed;
            }

            return time.TotalMilliseconds / numbers.Count();
        }

        private static double FindValuesInCollection(ICollection<int> collection, int[] numbers, int[] randomIndexes)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            TimeSpan time = new TimeSpan();
            for (int i = 0; i < randomIndexes.Count(); ++i)
            {
                stopwatch.Restart();
                collection.Contains(numbers[randomIndexes[i]]);
                time += stopwatch.Elapsed;
            }
            return time.TotalMilliseconds / numbers.Count();
        }

        private static double BuildAndCheckCollection(ICollection<int> collection, int[] numbers)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            TimeSpan time = new TimeSpan();
            for (int i = 0; i < numbers.Count(); ++i)
            {
                stopwatch.Restart();
                collection.Add(numbers[i]);
                time += stopwatch.Elapsed;
            }

            if (collection.Count != numbers.Count())
                throw new InvalidOperationException();

            return time.TotalMilliseconds / numbers.Count();
        }

        private static int[] GetUniqueRandomNumbers(Random rng, int n, int min, int max)
        {
            Dictionary<int, int> numbers = new Dictionary<int, int>(n);
            while (numbers.Count < n)
            {
                int num = rng.Next(min, max);
                numbers[num] = num;
            }

            int[] keys = numbers.Keys.ToArray();
            numbers = null;

            if (keys.Count() != n)
                throw new InvalidOperationException();

            return keys;
        }
    }
}