| 1 |
/*
|
| 2 |
* PROGRAM: Server Code
|
| 3 |
* MODULE: rpb_chain.h
|
| 4 |
* DESCRIPTION: Keeps track of record_param's, updated_in_place by
|
| 5 |
* single transcation
|
| 6 |
*
|
| 7 |
* The contents of this file are subject to the Interbase Public
|
| 8 |
* License Version 1.0 (the "License"); you may not use this file
|
| 9 |
* except in compliance with the License. You may obtain a copy
|
| 10 |
* of the License at http://www.Inprise.com/IPL.html
|
| 11 |
*
|
| 12 |
* Software distributed under the License is distributed on an
|
| 13 |
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
| 14 |
* or implied. See the License for the specific language governing
|
| 15 |
* rights and limitations under the License.
|
| 16 |
*
|
| 17 |
* Created by: Alex Peshkov <peshkoff@mail.ru>
|
| 18 |
*
|
| 19 |
* All Rights Reserved.
|
| 20 |
* Contributor(s): ______________________________________.
|
| 21 |
*/
|
| 22 |
|
| 23 |
#ifndef JRD_RPB_CHAIN_H
|
| 24 |
#define JRD_RPB_CHAIN_H
|
| 25 |
|
| 26 |
#include "../jrd/gdsassert.h"
|
| 27 |
#include <string.h>
|
| 28 |
|
| 29 |
#include "../common/classes/array.h"
|
| 30 |
#include "../jrd/jrd.h"
|
| 31 |
#include "../jrd/req.h"
|
| 32 |
|
| 33 |
// req.h defines struct record_param
|
| 34 |
|
| 35 |
namespace Jrd {
|
| 36 |
|
| 37 |
class traRpbListElement
|
| 38 |
{
|
| 39 |
public:
|
| 40 |
record_param* lr_rpb;
|
| 41 |
int level;
|
| 42 |
traRpbListElement(record_param* r, USHORT l) :
|
| 43 |
lr_rpb(r), level(l) {}
|
| 44 |
traRpbListElement() {}
|
| 45 |
|
| 46 |
static inline const bool greaterThan(const traRpbListElement& i1, const traRpbListElement& i2)
|
| 47 |
{
|
| 48 |
return i1.lr_rpb->rpb_relation->rel_id != i2.lr_rpb->rpb_relation->rel_id ?
|
| 49 |
i1.lr_rpb->rpb_relation->rel_id > i2.lr_rpb->rpb_relation->rel_id :
|
| 50 |
i1.lr_rpb->rpb_number != i2.lr_rpb->rpb_number ?
|
| 51 |
i1.lr_rpb->rpb_number > i2.lr_rpb->rpb_number :
|
| 52 |
i1.level > i2.level;
|
| 53 |
}
|
| 54 |
|
| 55 |
static inline const traRpbListElement& generate(const void *sender, const traRpbListElement& Item)
|
| 56 |
{
|
| 57 |
return Item;
|
| 58 |
}
|
| 59 |
};
|
| 60 |
|
| 61 |
|
| 62 |
typedef Firebird::SortedArray<traRpbListElement,
|
| 63 |
Firebird::InlineStorage<traRpbListElement, 16>, traRpbListElement,
|
| 64 |
traRpbListElement, traRpbListElement> traRpbArray;
|
| 65 |
class traRpbList : public traRpbArray
|
| 66 |
{
|
| 67 |
public:
|
| 68 |
traRpbList(Firebird::MemoryPool& p) :
|
| 69 |
traRpbArray(p) {}
|
| 70 |
int PushRpb(record_param* value);
|
| 71 |
bool PopRpb(record_param* value, int Level);
|
| 72 |
};
|
| 73 |
|
| 74 |
} //namespace Jrd
|
| 75 |
|
| 76 |
#endif //JRD_RPB_CHAIN_H
|
| 77 |
|