stmem.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_STMEM_H
10 #define SQUID_STMEM_H
11 
12 #include "base/Range.h"
13 #include "splay.h"
14 
15 class mem_node;
16 
17 class StoreIOBuffer;
18 
19 class mem_hdr
20 {
21 
22 public:
23  mem_hdr();
24  ~mem_hdr();
25  void freeContent();
26  int64_t lowestOffset () const;
27  int64_t endOffset () const;
28  int64_t freeDataUpto (int64_t);
29  ssize_t copy (StoreIOBuffer const &) const;
30  bool hasContigousContentRange(Range<int64_t> const &range) const;
31  /* success or fail */
32  bool write (StoreIOBuffer const &);
33  void dump() const;
34  size_t size() const;
35  /* Not an iterator - thus the start, not begin() */
36  mem_node const *start() const;
37  mem_node *getBlockContainingLocation (int64_t location) const;
38  /* access the contained nodes - easier than punning
39  * as a contianer ourselves
40  */
41  const Splay<mem_node *> &getNodes() const;
42  char * NodeGet(mem_node * aNode);
43 
44  /* Only for use of MemObject */
45  void internalAppend(const char *data, int len);
46 
48 
49 private:
50  void debugDump() const;
51  bool unlink(mem_node *aNode);
52  void makeAppendSpace();
53  int appendToNode(mem_node *aNode, const char *data, int maxLength);
54  void appendNode (mem_node *aNode);
55  size_t copyAvailable(mem_node *aNode, int64_t location, size_t amount, char *target) const;
56  bool unionNotEmpty (StoreIOBuffer const &);
57  mem_node *nodeToRecieve(int64_t offset);
58  size_t writeAvailable(mem_node *aNode, int64_t location, size_t amount, char const *source);
59  int64_t inmem_hi;
61 };
62 
63 #endif /* SQUID_STMEM_H */
64 
bool unlink(mem_node *aNode)
Definition: stmem.cc:68
int64_t endOffset() const
Definition: stmem.cc:46
int64_t freeDataUpto(int64_t)
Definition: stmem.cc:82
size_t size() const
Definition: stmem.cc:408
void internalAppend(const char *data, int len)
Definition: stmem.cc:158
void makeAppendSpace()
Definition: stmem.cc:144
bool unionNotEmpty(StoreIOBuffer const &)
Definition: stmem.cc:299
mem_node const * start() const
Definition: stmem.cc:414
void dump() const
Definition: stmem.cc:401
size_t copyAvailable(mem_node *aNode, int64_t location, size_t amount, char *target) const
Definition: stmem.cc:190
Definition: Range.h:18
Definition: stmem.h:19
int64_t inmem_hi
Definition: stmem.h:59
int appendToNode(mem_node *aNode, const char *data, int maxLength)
Definition: stmem.cc:105
int64_t lowestOffset() const
Definition: stmem.cc:35
void const char HLPCB void * data
Definition: stub_helper.cc:16
bool write(StoreIOBuffer const &)
Definition: stmem.cc:342
Splay< mem_node * > nodes
Definition: stmem.h:60
ssize_t copy(StoreIOBuffer const &) const
Definition: stmem.cc:226
void appendNode(mem_node *aNode)
Definition: stmem.cc:138
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
mem_node * nodeToRecieve(int64_t offset)
Definition: stmem.cc:308
static Splay< mem_node * >::SPLAYCMP NodeCompare
Definition: stmem.h:47
mem_hdr()
Definition: stmem.cc:374
void debugDump() const
Definition: stmem.cc:209
~mem_hdr()
Definition: stmem.cc:379
const Splay< mem_node * > & getNodes() const
Definition: stmem.cc:425
bool hasContigousContentRange(Range< int64_t > const &range) const
Definition: stmem.cc:284
char * NodeGet(mem_node *aNode)
Definition: stmem.cc:27
size_t writeAvailable(mem_node *aNode, int64_t location, size_t amount, char const *source)
Definition: stmem.cc:112
mem_node * getBlockContainingLocation(int64_t location) const
Definition: stmem.cc:176
void freeContent()
Definition: stmem.cc:60

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors