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::os {
14 
24 {
25 public:
27  {
28  NoLocation = 0x0000,
29  Directory = 0x0001, // Search current directory
30  Context = 0x0002, // Search current context directory
31  Robot = 0x0004, // Search current robot directory
32  User = 0x0008, // Search user directory
33  Sysadmin = 0x0010, // Search system config directories
34  Installed = 0x0020, // Search system data directories + path.d
35  NearMainConfig = 0x0040, // Search directory of main config file
36  // (if one is used, e.g. with --from)
37  ClassicContext = 0x1000, // Search old-style context directories
38  Default = User | Sysadmin | Installed,
39  ModuleDefault = Default | Robot | Context | Directory | ClassicContext | NearMainConfig
40  };
41 
43  {
44  First, // Keep only the first file found
45  All // Keep all the files
46  };
47 
49  {
50  ConfigLike = 0x0001,
51  DataLike = 0x0002,
52  ConfigAndDataLike = ConfigLike | DataLike
53  };
54 
56  {
57  ShowNone = 0x0000,
58  ShowDirectories = 0x0001,
59  ShowErrors = 0x0002,
60  ShowFromFlags = 0x0004,
61  ShowAll = ShowDirectories | ShowErrors
62  };
63 
69 
70  ResourceFinderOptions(SearchLocations searchLocations = ModuleDefault,
71  DuplicateFilesPolicy duplicateFilesPolicy = First,
72  SearchFlavor searchFlavor = ConfigAndDataLike,
73  const std::string& resourceType = "",
74  MessageFilter messageFilter = ShowFromFlags);
75 
77  {
78  return ResourceFinderOptions();
79  }
80 
82  {
83  return ResourceFinderOptions(ModuleDefault, All);
84  }
85 };
86 
87 } // namespace yarp::os
88 
89 #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()
An interface to the operating system, including Port based communication.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:338
#define YARP_os_API
Definition: api.h:18