Medical Imaging Interaction Toolkit  2023.12.99-1652ac8d
Medical Imaging Interaction Toolkit
usModuleResource.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center (DKFZ)
6  All rights reserved.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  https://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 ============================================================================*/
21 
22 
23 #ifndef USMODULERESOURCE_H
24 #define USMODULERESOURCE_H
25 
26 #include <usCoreExport.h>
27 
28 #include <ostream>
29 #include <vector>
30 
32 
34 
35 class ModuleResourcePrivate;
36 class ModuleResourceContainer;
37 
56 {
57 
58 private:
59 
60  typedef ModuleResourcePrivate* ModuleResource::*bool_type;
61 
62 public:
63 
72  ModuleResource(const ModuleResource& resource);
73 
74  ~ModuleResource();
75 
82  ModuleResource& operator=(const ModuleResource& resource);
83 
92  bool operator<(const ModuleResource& resource) const;
93 
102  bool operator==(const ModuleResource& resource) const;
103 
110  bool operator!=(const ModuleResource& resource) const;
111 
121  bool IsValid() const;
122 
126  operator bool_type() const;
127 
140  std::string GetName() const;
141 
156  std::string GetPath() const;
157 
164  std::string GetResourcePath() const;
165 
178  std::string GetBaseName() const;
179 
192  std::string GetCompleteBaseName() const;
193 
209  std::string GetSuffix() const;
210 
226  std::string GetCompleteSuffix() const;
227 
234  bool IsDir() const;
235 
241  bool IsFile() const;
242 
251  std::vector<std::string> GetChildren() const;
252 
261  std::vector<ModuleResource> GetChildResources() const;
262 
268  int GetSize() const;
269 
275  time_t GetLastModified() const;
276 
277 private:
278 
279  ModuleResource(const std::string& file, const ModuleResourceContainer& resourceContainer);
280  ModuleResource(int index, const ModuleResourceContainer& resourceContainer);
281 
282  friend class Module;
283  friend class ModulePrivate;
284  friend class ModuleResourceContainer;
285  friend class ModuleResourceStream;
286 
288 
289  std::size_t Hash() const;
290 
291  void* GetData() const;
292 
293  ModuleResourcePrivate* d;
294 
295 };
296 
298 
300 
304 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const US_PREPEND_NAMESPACE(ModuleResource)& resource);
305 
308  return arg.Hash();
311 
312 #endif // USMODULERESOURCE_H
US_MSVC_POP_WARNING
#define US_MSVC_POP_WARNING
Definition: usGlobalConfig.h:138
US_HASH_FUNCTION_FRIEND
#define US_HASH_FUNCTION_FRIEND(type)
Definition: usGlobalConfig.h:180
usCoreExport.h
US_MSVC_PUSH_DISABLE_WARNING
#define US_MSVC_PUSH_DISABLE_WARNING(wn)
Definition: usGlobalConfig.h:137
operator<<
US_MSVC_POP_WARNING US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const us::ModuleResource &resource)
mitk::modelFit::operator<
bool operator<(const StaticParameterMap::ValueType &a, const StaticParameterMap::ValueType &b)
Compares two var lists and returns true if the first list's first item is lower than the second one's...
Definition: mitkModelFitStaticParameterMap.h:139
US_HASH_FUNCTION_END
#define US_HASH_FUNCTION_END
Definition: usGlobalConfig.h:202
US_HASH_FUNCTION_NAMESPACE_BEGIN
#define US_HASH_FUNCTION_NAMESPACE_BEGIN
Definition: usGlobalConfig.h:184
US_HASH_FUNCTION_BEGIN
#define US_HASH_FUNCTION_BEGIN(type)
Definition: usGlobalConfig.h:197
mitk::operator!=
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
us::Module
Definition: usModule.h:78
US_BEGIN_NAMESPACE
#define US_BEGIN_NAMESPACE
Definition: usGlobalConfig.h:76
us::ModuleResource
Definition: usModuleResource.h:55
US_END_NAMESPACE
#define US_END_NAMESPACE
Definition: usGlobalConfig.h:77
US_PREPEND_NAMESPACE
#define US_PREPEND_NAMESPACE(name)
Definition: usGlobalConfig.h:74
US_HASH_FUNCTION_NAMESPACE_END
#define US_HASH_FUNCTION_NAMESPACE_END
Definition: usGlobalConfig.h:185
US_Core_EXPORT
#define US_Core_EXPORT
Definition: usCoreExport.h:21
us::ModuleResourceStream
Definition: usModuleResourceStream.h:43
Hash
US_HASH_FUNCTION_NAMESPACE_BEGIN return arg Hash()