Back to index

nordugrid-arc-nox  1.1.0~rc6
DataPointIndex.h
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #ifndef __ARC_DATAPOINTINDEX_H__
00004 #define __ARC_DATAPOINTINDEX_H__
00005 
00006 #include <list>
00007 #include <string>
00008 
00009 #include <arc/data/DataHandle.h>
00010 #include <arc/data/DataPoint.h>
00011 
00012 namespace Arc {
00013 
00015 
00017   class DataPointIndex
00018     : public DataPoint {
00019   public:
00020     DataPointIndex(const URL& url, const UserConfig& usercfg);
00021     virtual ~DataPointIndex();
00022 
00023     virtual const URL& CurrentLocation() const;
00024     virtual const std::string& CurrentLocationMetadata() const;
00025     
00026     virtual DataStatus CompareLocationMetadata() const;
00027     virtual bool NextLocation();
00028     virtual bool LocationValid() const;
00029     virtual bool HaveLocations() const;
00030     virtual DataStatus RemoveLocation();
00031     virtual DataStatus RemoveLocations(const DataPoint& p);
00032     virtual DataStatus AddLocation(const URL& url, const std::string& meta);
00033 
00034     virtual bool IsIndex() const;
00035     virtual bool AcceptsMeta();
00036     virtual bool ProvidesMeta();
00037     virtual bool Registered() const;
00038 
00039     virtual void SetTries(const int n);
00040 
00041     // the following are relayed to the current location
00042     virtual long long int BufSize() const;
00043     virtual int BufNum() const;
00044     virtual bool Local() const;
00045     virtual bool ReadOnly() const;
00046 
00047     virtual DataStatus StartReading(DataBuffer& buffer);
00048     virtual DataStatus StartWriting(DataBuffer& buffer,
00049                                     DataCallback *space_cb = NULL);
00050     virtual DataStatus StopReading();
00051     virtual DataStatus StopWriting();
00052 
00053     virtual DataStatus Check();
00054 
00055     virtual DataStatus Remove();
00056 
00057     virtual void ReadOutOfOrder(bool v);
00058     virtual bool WriteOutOfOrder();
00059 
00060     virtual void SetAdditionalChecks(bool v);
00061     virtual bool GetAdditionalChecks() const;
00062 
00063     virtual void SetSecure(bool v);
00064     virtual bool GetSecure() const;
00065 
00066     virtual void Passive(bool v);
00067 
00068     virtual void Range(unsigned long long int start = 0,
00069                        unsigned long long int end = 0);
00070   protected:
00071     bool resolved;
00072     bool registered;
00073     void ClearLocations() {
00074       locations.clear();
00075       location = locations.end();
00076       SetHandle();
00077     };
00078   private:
00079     // Following members must be kept synchronised hence they are private
00081     std::list<URLLocation> locations;
00082     std::list<URLLocation>::iterator location;
00083     DataHandle *h;
00084     void SetHandle();
00085   };
00086 
00087 } // namespace Arc
00088 
00089 #endif // __ARC_DATAPOINTINDEX_H__