qpid/console/ObjectId.h Source File

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

qpid/console/ObjectId.h
Go to the documentation of this file.

    00001 /*
    00002  *
    00003  * Licensed to the Apache Software Foundation (ASF) under one
    00004  * or more contributor license agreements.  See the NOTICE file
    00005  * distributed with this work for additional information
    00006  * regarding copyright ownership.  The ASF licenses this file
    00007  * to you under the Apache License, Version 2.0 (the
    00008  * "License"); you may not use this file except in compliance
    00009  * with the License.  You may obtain a copy of the License at
    00010  *
    00011  *   http://www.apache.org/licenses/LICENSE-2.0
    00012  *
    00013  * Unless required by applicable law or agreed to in writing,
    00014  * software distributed under the License is distributed on an
    00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    00016  * KIND, either express or implied.  See the License for the
    00017  * specific language governing permissions and limitations
    00018  * under the License.
    00019  *
    00020  */
    00021 #ifndef _QPID_CONSOLE_OBJECTID_H
    00022 #define _QPID_CONSOLE_OBJECTID_H
    00023
    00024 #include <iostream>
    00025 #include "qpid/console/ConsoleImportExport.h"
    00026 #include "qpid/sys/IntegerTypes.h"
    00027
    00028 namespace qpid {
    00029 namespace framing {
    00030     class Buffer;
    00031 }
    00032 namespace console {
    00033
    00038     class QPID_CONSOLE_EXTERN ObjectId {
    00039     public:
    00040         ObjectId() : first(0), second(0) {}
    00041         ObjectId(framing::Buffer& buffer);
    00042
    00043         uint8_t getFlags() const { return (uint8_t)((first & 0xF000000000000000LL) >> 60); }
    00044         uint16_t getSequence() const { return (uint16_t)((first & 0x0FFF000000000000LL) >> 48); }
    00045         uint32_t getBrokerBank() const { return (uint32_t)((first & 0x0000FFFFF0000000LL) >> 28); }
    00046         uint32_t getAgentBank() const { return (uint32_t) (first & 0x000000000FFFFFFFLL); }
    00047         uint64_t getObject() const { return second; }
    00048         bool isDurable() const { return getSequence() == 0; }
    00049         void decode(framing::Buffer& buffer);
    00050         void encode(framing::Buffer& buffer);
    00051         void setValue(uint64_t f, uint64_t s) { first = f; second = s; }
    00052
    00053         bool operator==(const ObjectId& other) const;
    00054         bool operator!=(const ObjectId& other) const;
    00055         bool operator<(const ObjectId& other) const;
    00056         bool operator>(const ObjectId& other) const;
    00057         bool operator<=(const ObjectId& other) const;
    00058         bool operator>=(const ObjectId& other) const;
    00059
    00060     private:
    00061         uint64_t first;
    00062         uint64_t second;
    00063     };
    00064
    00065     QPID_CONSOLE_EXTERN std::ostream& operator<<(std::ostream& o, const ObjectId& id);
    00066 }
    00067 }
    00068
    00069 #endif