28 int adbncPush(
const string& strLocalSource,
const string& strRemoteDestination);
57 if (m_pReadLinkOutput)
58 delete m_pReadLinkOutput;
61 m_pReadLinkOutput = NULL;
84 if (m_pReadLinkOutput)
85 delete m_pReadLinkOutput;
93 m_pStatOutput =
new deque<string>(output);
98 if (m_pReadLinkOutput)
99 delete m_pReadLinkOutput;
101 m_pReadLinkOutput =
new deque<string>(output);
113 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
123 it->second.timeStamp(::time(NULL));
136 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
146 it->second.timeStamp(::time(NULL));
152 const deque<string>* pOut(NULL);
154 const map<string, Entry>::const_iterator it(
m_Entries.find(pcPath));
158 pOut = it->second.statOutput();
166 const deque<string>* pOut(NULL);
168 const map<string, Entry>::const_iterator it(
m_Entries.find(pcPath));
172 pOut = it->second.readLinkOutput();
185 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
197 const time_t current = ::time(NULL);
207 if (::close(iFh) == -1)
211 m_fPendingOpen =
false;
223 if (!m_strRenamedFromLocal.empty())
226 iRes =
adbncPush(m_strRenamedFromLocal, strToPath);
228 m_strRenamedFromLocal.clear();
233 iRes =
adbncPush(strFromLocalPath, strToPath);
236 pendingOpen(
false,
false);
269 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
275 m_Entries.insert(make_pair(pcPath, entry));
278 it->second.pendingOpen(fPendingOpen, fForWrite);
289 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
295 m_Entries.insert(make_pair(pcPath, entry));
298 it->second.pendingOpen(strRenamedFromLocal);
303 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
309 m_Entries.insert(make_pair(pcPath, entry));
312 it->second.truncated(fTruncated);
319 const map<string, Entry>::const_iterator it(
m_Entries.find(pcPath));
322 fRet = it->second.pendingOpen();
331 const map<string, Entry>::const_iterator it(
m_Entries.find(pcPath));
334 fRet = it->second.truncated();
343 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
346 iRes = it->second.flush(strFromLocalPath, pcPath);
355 const map<string, Entry>::iterator it(
m_Entries.find(pcPath));
358 iRet = it->second.release(iFh);
deque< string > * m_pStatOutput
void putStat(const char *pcPath, const deque< string > &statOutput)
Caches the output of doStat().
void putReadLink(const char *pcPath, const deque< string > &readLinkOutput)
Caches the output of adbnc_readlink().
void statOutput(const deque< string > &output)
void pendingOpen(const char *pcPath, const bool fPendingOpen, const bool fForWrite)
Notes that on the given path a read or write operation has been performed.
deque< string > * m_pReadLinkOutput
Entry()
Default constructor.
const deque< string > * statOutput() const
int release(const int iFh)
bool isValid(const Entry &entry) const
Tests if the given cache entry is valid.
void truncated(const bool fTruncated)
void readLinkOutput(const deque< string > &output)
virtual ~Entry()
Virtual destructor.
int adbncShell(const string &strCommand)
void timeStamp(const time_t &time)
Set the entries time stamp.
Represents an entry of FileStatus.
int adbncPush(const string &strLocalSource, const string &strRemoteDestination)
Copy (using adb push) a file from the local host to the Android device.
Represents an entry of FileCache.
Entry & operator=(const Entry &orig)
Assignment operator.
void invalidate(const char *pcPath)
Renders the cashed data for the given file as invalid.
const deque< string > * getReadLink(const char *pcPath) const
int flush(const string &strFromLocalPath, const string &strToPat)
static const int iFileDataCacheSecondsValid(120)
Keep cache entries valid for 120 seconds.
const deque< string > * readLinkOutput() const
int release(const char *pcPath, const int iFh)
void pendingOpen(const bool fPendingOpen, const bool fForWrite)
const deque< string > * getStat(const char *pcPath) const
int flush(const char *pcPath, const string &strFromLocalPath)
map< string, Entry > m_Entries
void truncated(const char *pcPath, const bool fTruncated)