Ignore:
Timestamp:
Apr 1, 2012 10:44:45 PM (8 years ago)
Author:
ldelgass
Message:

style fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/Chain.h

    r2798 r2923  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * Chain.h --
     3 * Copyright 1993-2004 George A Howlett.
    44 *
    5  *      Copyright 1993-2004 George A Howlett.
     5 * Permission is hereby granted, free of charge, to any person obtaining
     6 * a copy of this software and associated documentation files (the
     7 * "Software"), to deal in the Software without restriction, including
     8 * without limitation the rights to use, copy, modify, merge, publish,
     9 * distribute, sublicense, and/or sell copies of the Software, and to
     10 * permit persons to whom the Software is furnished to do so, subject to
     11 * the following conditions:
    612 *
    7  *      Permission is hereby granted, free of charge, to any person obtaining
    8  *      a copy of this software and associated documentation files (the
    9  *      "Software"), to deal in the Software without restriction, including
    10  *      without limitation the rights to use, copy, modify, merge, publish,
    11  *      distribute, sublicense, and/or sell copies of the Software, and to
    12  *      permit persons to whom the Software is furnished to do so, subject to
    13  *      the following conditions:
     13 * The above copyright notice and this permission notice shall be
     14 * included in all copies or substantial portions of the Software.
    1415 *
    15  *      The above copyright notice and this permission notice shall be
    16  *      included in all copies or substantial portions of the Software.
    17  *
    18  *      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    19  *      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    20  *      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    21  *      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    22  *      LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    23  *      OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    24  *      WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
     20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2523 */
    26 #ifndef _CHAIN_H
    27 #define _CHAIN_H
     24#ifndef CHAIN_H
     25#define CHAIN_H
    2826
    29 /*
    30  * A ChainLink is the container structure for the Chain.
     27/**
     28 * \brief A ChainLink is the container structure for the Chain.
    3129 */
    32 class ChainLink {
     30class ChainLink
     31{
     32public:
     33    ChainLink()
     34    {
     35        _clientData = NULL;
     36        _next = _prev = NULL;
     37    }
     38
     39    ChainLink(void *clientData)
     40    {
     41        _clientData = clientData;
     42         _next = _prev = NULL;
     43    }
     44
     45    void *getValue()
     46    {
     47        return _clientData;
     48    }
     49
     50    void setValue(void *clientData)
     51    {
     52        _clientData = clientData;
     53    }
     54
     55    ChainLink *next()
     56    {
     57        return _next;
     58    }
     59
     60    ChainLink *prev()
     61    {
     62        return _prev;
     63    }
     64
    3365    friend class Chain;
     66
    3467private:
    35     ChainLink *_prev;           /* Link to the previous link */
    36     ChainLink *_next;           /* Link to the next link */
    37     void *_clientData;          /* Pointer to the data object */
    38 public:
    39     ChainLink(void) {
    40         _clientData = NULL;
    41         _next = _prev = NULL;
    42     }
    43     ChainLink(void *clientData) {
    44         _clientData = clientData;
    45         _next = _prev = NULL;
    46     }
    47     void *GetValue(void) {
    48         return _clientData;
    49     }
    50     void SetValue(void *clientData) {
    51         _clientData = clientData;
    52     }
    53     ChainLink *Next(void) {
    54         return _next;
    55     }
    56     ChainLink *Prev(void) {
    57         return _prev;
    58     }
     68    ChainLink *_prev;  ///< Link to the previous link
     69    ChainLink *_next;  ///< Link to the next link
     70    void *_clientData; ///< Pointer to the data object
    5971};
    6072
    6173typedef int (ChainCompareProc) (ChainLink *l1Ptr, ChainLink *l2Ptr);
    6274
    63 /*
    64  * A Chain is a doubly linked list structure.
     75/**
     76 * \brief A Chain is a doubly linked list structure.
    6577 */
    66 class Chain {
     78class Chain
     79{
     80public:
     81    Chain()
     82    {
     83        init();
     84    }
     85    ~Chain()
     86    {
     87        reset();
     88    }
     89
     90    void init()
     91    {
     92        _nLinks = 0;
     93        _head = _tail = NULL;
     94    }
     95
     96    ChainLink *append(void *clientData);
     97
     98    ChainLink *prepend(void *clientData);
     99
     100    ChainLink *getNthLink(long position);
     101
     102    void linkBefore(ChainLink *linkPtr, ChainLink *beforePtr);
     103
     104    void linkAfter(ChainLink *linkPtr, ChainLink *afterPtr);
     105
     106    void deleteLink(ChainLink *linkPtr);
     107
     108    void unlink(ChainLink *linkPtr);
     109
     110    void reset();
     111
     112    void sort(ChainCompareProc *proc);
     113
     114    long getLength()
     115    {
     116        return _nLinks;
     117    }
     118
     119    ChainLink *firstLink()
     120    {
     121        return _head;
     122    }
     123
     124    ChainLink *lastLink()
     125    {
     126        return _tail;
     127    }
     128
     129    void appendLink(ChainLink *linkPtr)
     130    {
     131        linkBefore(linkPtr, (ChainLink *)NULL);
     132    }
     133
     134    void prependLink(ChainLink *linkPtr)
     135    {
     136        linkAfter(linkPtr, (ChainLink *)NULL);
     137    }
     138
    67139private:
    68     ChainLink *_head;           /* Pointer to first element in chain */
    69     ChainLink *_tail;           /* Pointer to last element in chain */
    70     long _nLinks;               /* Number of elements in chain */
    71 public:
    72     Chain(void) {
    73         Init();
    74     }
    75     ~Chain(void) {
    76         Reset();
    77     }
    78     void Init(void) {
    79         _nLinks = 0;
    80         _head = _tail = NULL;
    81     }
    82     ChainLink *Append(void *clientData);
    83     ChainLink *Prepend(void *clientData);
    84     ChainLink *GetNthLink(long position);
    85     void LinkBefore(ChainLink *linkPtr, ChainLink *beforePtr);
    86     void LinkAfter(ChainLink *linkPtr, ChainLink *afterPtr);
    87     void DeleteLink(ChainLink *linkPtr);
    88     void Unlink(ChainLink *linkPtr);
    89     void Reset(void);
    90     void Sort(ChainCompareProc *proc);
    91     long GetLength(void)   {
    92         return _nLinks;
    93     }
    94     ChainLink *FirstLink(void) {
    95         return _head;
    96     }
    97     ChainLink *LastLink(void) {
    98         return _tail;
    99     }
    100     void AppendLink(ChainLink *linkPtr) {
    101         LinkBefore(linkPtr, (ChainLink *)NULL);
    102     }
    103     void PrependLink(ChainLink *linkPtr) {
    104         LinkAfter(linkPtr, (ChainLink *)NULL);
    105     }
     140    ChainLink *_head; ///< Pointer to first element in chain
     141    ChainLink *_tail; ///< Pointer to last element in chain
     142    long _nLinks;     ///< Number of elements in chain
    106143};
    107144
    108 #endif /* _CHAIN_H */
     145#endif
Note: See TracChangeset for help on using the changeset viewer.