|
||||
File indexing completed on 2025-01-18 09:28:09
0001 // -*- C++ -*- 0002 // AID-GENERATED 0003 // ========================================================================= 0004 // This class was generated by AID - Abstract Interface Definition 0005 // DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 0006 // ========================================================================= 0007 #ifndef AIDA_ITREE_H 0008 #define AIDA_ITREE_H 1 0009 0010 // This file is part of the AIDA library 0011 // Copyright (C) 2002 by the AIDA team. All rights reserved. 0012 // This library is free software and under the terms of the 0013 // GNU Library General Public License described in the LGPL.txt 0014 0015 #include <iostream> 0016 #include <string> 0017 #include <vector> 0018 0019 namespace AIDA { 0020 0021 class IManagedObject; 0022 0023 /** 0024 * User level interface to a Tree. 0025 * 0026 * All paths follow unix convention .., ., /, 0027 * backslash is the escape character. 0028 * Relative paths are allowed. 0029 * 0030 * NOTE: - this tree keeps a current position(pwd) within the tree. 0031 * This may be implemented on a per-thread basis. 0032 * 0033 * @author The AIDA team (http://aida.freehep.org/) 0034 * 0035 */ 0036 0037 class ITree { 0038 0039 public: 0040 /// Destructor. 0041 virtual ~ITree() { /* nop */; } 0042 0043 /** 0044 * Get the name of the store. 0045 * @return The store's name. 0046 * 0047 */ 0048 virtual std::string storeName() const = 0; 0049 0050 /** 0051 * Get the IManagedObject at a given path in the ITree. The path can either be 0052 * absolute or relative to the current working directory. 0053 * @param path The path. 0054 * @return The corresponding IManagedObject. 0055 * 0056 */ 0057 virtual IManagedObject * find(const std::string & path) = 0; 0058 0059 /** 0060 * Get a mounted ITree at a given path in the current ITree. The path can either be 0061 * absolute or relative to the current working directory. 0062 * @param path The path. 0063 * @return The corresponding ITree. 0064 * 0065 */ 0066 virtual ITree * findTree(const std::string & path) = 0; 0067 0068 /** 0069 * Change to a given directory. 0070 * @param path The absolute or relative path of the directory we are changing to. 0071 * @return false If the path does not exist. 0072 * 0073 */ 0074 virtual bool cd(const std::string & path) = 0; 0075 0076 /** 0077 * Get the path of the current working directory. 0078 * @return The path of the current working directory. 0079 * 0080 */ 0081 virtual std::string pwd() const = 0; 0082 0083 /** 0084 * List, into a given output stream, all the IManagedObjects, including directories 0085 * (but not "." and ".."), in a given path. Directories end with "/". The list can be recursive. 0086 * @param path The path where the list has to be performed (by default the current directory "."). 0087 * @param recursive If <code>true</code> the list is extended recursively 0088 * in all the directories under path (the default is <code>false</code>. 0089 * @param os The output stream into which the list is dumped (by default the standard output). 0090 * @return false If the path does not exist. 0091 * 0092 */ 0093 virtual bool ls(const std::string & path = ".", bool recursive = false, std::ostream & os = std::cout) const = 0; 0094 0095 /** 0096 * Get the list of names of the IManagedObjects under a given path, including directories 0097 * (but not "." and ".."). Directories end with "/". 0098 * The returned names are appended to the given path unless the latter is ".". 0099 * @param path The path where the list has to be performed (by default the current directory "."). 0100 * @param recursive If <code>true</code> the list is extended recursively 0101 * in all the directories under path (the default is <code>false</code>. 0102 * 0103 */ 0104 virtual std::vector<std::string> listObjectNames(const std::string & path = ".", bool recursive = false) const = 0; 0105 0106 /** 0107 * Get the list of types of the IManagedObjects under a given path. 0108 * The types are the leaf class of the Interface, e.g. "IHistogram1D", "ITuple", etc. 0109 * Directories are marked with "dir". 0110 * The order of the types is the same as the order for the listObjectNames() method 0111 * to achieve a one-to-one correspondance between object names and types. 0112 * @param path The path where the list has to be performed (by default the current directory "."). 0113 * @param recursive If <code>true</code> the list is extended recursively 0114 * in all the directories under path (the default is <code>false</code>. 0115 * 0116 */ 0117 virtual std::vector<std::string> listObjectTypes(const std::string & path = ".", bool recursive = false) const = 0; 0118 0119 /** 0120 * Create a new directory. Given a path only the last directory 0121 * in it is created if all the intermediate subdirectories already exist. 0122 * @param path The absolute or relative path of the new directory. 0123 * @return false If a subdirectory within the path does 0124 * not exist or it is not a directory. Also if the directory already exists. 0125 * 0126 */ 0127 virtual bool mkdir(const std::string & path) = 0; 0128 0129 /** 0130 * Create a directory recursively. Given a path the last directory 0131 * and all the intermediate non-existing subdirectories are created. 0132 * @param path The absolute or relative path of the new directory. 0133 * @return false If an intermediate subdirectory 0134 * is not a directory, or if the directory already exists. 0135 * 0136 */ 0137 virtual bool mkdirs(const std::string & path) = 0; 0138 0139 /** 0140 * Remove a directory and all the contents underneeth. 0141 * @param path The absolute or relative path of the directory to be removed. 0142 * @return false If path does not exist or if it is not 0143 * a directory. 0144 * 0145 */ 0146 virtual bool rmdir(const std::string & path) = 0; 0147 0148 /** 0149 * Remove an IManagedObject by specifying its path. 0150 * If the path points to a mount point, the mount point should first commit, then 0151 * close and delete the tree object. 0152 * @param path The absolute or relative path of the IManagedObject to be removed. 0153 * @return false If path does not exist. 0154 * 0155 */ 0156 virtual bool rm(const std::string & path) = 0; 0157 0158 /** 0159 * Get the full path of an IManagedObject. 0160 * @param object The IManagedObject whose path is to be returned. 0161 * @return The object's absolute path. 0162 * In C++ if the object does not exist, an empty string is returned. 0163 * 0164 */ 0165 virtual std::string findPath(const IManagedObject & object) const = 0; 0166 0167 /** 0168 * Move an IManagedObject or a directory from one directory to another. 0169 * @param oldPath The path of the IManagedObject or direcoty to be moved. 0170 * @param newPath The path of the diretory in which the object has to be moved to. 0171 * @return false If either path does not exist. 0172 * 0173 */ 0174 virtual bool mv(const std::string & oldPath, const std::string & newPath) = 0; 0175 0176 /** 0177 * Commit any open transaction to the underlying store(s). 0178 * It flushes objects into the disk for non-memory-mapped stores. 0179 * @return false If the underlying store cannot be written out. 0180 * 0181 */ 0182 virtual bool commit() = 0; 0183 0184 /** 0185 * Set the strategy of what should happen if two objects have the same path. 0186 * Default is overwrite. 0187 * @param overwrite <code>true</code> to enable overwriting. 0188 * 0189 */ 0190 virtual void setOverwrite(bool overwrite = true) = 0; 0191 0192 /** 0193 * Copy an object from a path to another. 0194 * @param oldPath The path of the object to be copied. 0195 * @param newPath The path where the object is to be copied. 0196 * @param recursive <code>true</code> if a recursive copy has to be performed. 0197 * @return false If either path does not exist. 0198 * 0199 */ 0200 virtual bool cp(const std::string & oldPath, const std::string & newPath, bool recursive = false) = 0; 0201 0202 /** 0203 * Create a symbolic link to an object in the ITree. 0204 * @param path The absolute or relative path of the object to be linked. 0205 * @param alias The absolute or relative name of the link. 0206 * @return false If path or any 0207 * subidrectory within path does not exist. 0208 * 0209 */ 0210 virtual bool symlink(const std::string & path, const std::string & alias) = 0; 0211 0212 /** 0213 * Mounts a tree within another (target) tree. A tree can only be mounted once. 0214 * Example: 0215 * <pre> 0216 * target.mount("/home/tonyj",tree,"/"); 0217 * </pre> 0218 * @param path The path in the target tree 0219 * @param tree The tree to mount within the target tree 0220 * @param treePath The mount point within the tree to be mounted. 0221 * @return false If something does not exist. 0222 * 0223 */ 0224 virtual bool mount(const std::string & path, ITree & tree, const std::string & treePath) = 0; 0225 0226 /** 0227 * Unmount a subtree at a given path (mount point). 0228 * Whenever a tree is destroyed it first unmounts all dependent trees. 0229 * @param path The path of the subtree to be unmounted. 0230 * @return false If path does not exist. 0231 * 0232 */ 0233 virtual bool unmount(const std::string & path) = 0; 0234 0235 /** 0236 * Closes the underlying store. 0237 * Changes will be saved only if commit() has been called before. 0238 * The call is propagated to the dependent mounted trees. 0239 * @return false If there are problems writing out 0240 * the underlying store. 0241 * 0242 */ 0243 virtual bool close() = 0; 0244 0245 /** 0246 * See IManagedObject for a description. 0247 * @param className The name of the class to cast on. 0248 * @return The right pointer. Return 0 if failure. 0249 */ 0250 virtual void * cast(const std::string & className) const = 0; 0251 }; // class 0252 } // namespace AIDA 0253 #endif /* ifndef AIDA_ITREE_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |