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