YARP
Yet Another Robot Platform
ResourceFinderOptions.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_OS_RESOURCEFINDEROPTIONS_H
7 #define YARP_OS_RESOURCEFINDEROPTIONS_H
8 
9 #include <yarp/os/api.h>
10 
11 #include <string>
12 
13 namespace yarp {
14 namespace os {
15 
25 {
26 public:
28  {
29  NoLocation = 0x0000,
30  Directory = 0x0001, // Search current directory
31  Context = 0x0002, // Search current context directory
32  Robot = 0x0004, // Search current robot directory
33  User = 0x0008, // Search user directory
34  Sysadmin = 0x0010, // Search system config directories
35  Installed = 0x0020, // Search system data directories + path.d
36  NearMainConfig = 0x0040, // Search directory of main config file
37  // (if one is used, e.g. with --from)
38  ClassicContext = 0x1000, // Search old-style context directories
39  Default = User | Sysadmin | Installed,
40  ModuleDefault = Default | Robot | Context | Directory | ClassicContext | NearMainConfig
41  };
42 
44  {
45  First, // Keep only the first file found
46  All // Keep all the files
47  };
48 
50  {
51  ConfigLike = 0x0001,
52  DataLike = 0x0002,
53  ConfigAndDataLike = ConfigLike | DataLike
54  };
55 
57  {
58  ShowNone = 0x0000,
59  ShowDirectories = 0x0001,
60  ShowErrors = 0x0002,
61  ShowFromFlags = 0x0004,
62  ShowAll = ShowDirectories | ShowErrors
63  };
64 
70 
71  ResourceFinderOptions(SearchLocations searchLocations = ModuleDefault,
72  DuplicateFilesPolicy duplicateFilesPolicy = First,
73  SearchFlavor searchFlavor = ConfigAndDataLike,
74  const std::string& resourceType = "",
75  MessageFilter messageFilter = ShowFromFlags);
76 
78  {
79  return ResourceFinderOptions();
80  }
81 
83  {
84  return ResourceFinderOptions(ModuleDefault, All);
85  }
86 };
87 
88 } // namespace os
89 } // namespace yarp
90 
91 #endif // YARP_OS_RESOURCEFINDER_H
These options are loosely based on http://wiki.icub.org/wiki/YARP_ResourceFinder.
DuplicateFilesPolicy duplicateFilesPolicy
static ResourceFinderOptions findAllMatch()
static ResourceFinderOptions findFirstMatch()
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:336
#define YARP_os_API
Definition: api.h:18