⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printout.ps

📁 obs网络试验平台
💻 PS
📖 第 1 页 / 共 4 页
字号:
( * notice appear in all copies and that both the copyright notice and) N( * this permission notice appear in supporting documentation. and that) N( * any documentation, advertising materials, and other materials related) N( * to such distribution and use acknowledge that the software was) N( * developed by the University of Maryland, Baltimore County.  The name of) N( * the University may not be used to endorse or promote products derived from) N( * this software without specific prior written permission.) N( *) N( * Copyright \(C\) 2000-2003 Washington State University. All rights reserved.) N( * This software was originally developed at Alcatel USA and subsequently modifi) N(ed) N( * at Washington State University, Pullman, WA  through research work which was) N( * supported by Alcatel USA, Inc and Cisco Systems Inc.) N() N( * The  following notice is in adherence to the Washington State University) N( * copyright policy follows.) N( *) N( * License is granted to copy, to use, and to make and to use derivative) N( * works for research and evaluation purposes, provided that Washington) N( * State University is acknowledged in all documentation pertaining to any such) N( * copy or derivative work. Washington State University grants no other) N( * licenses expressed or implied. The Washington State University name) N( * should not be used in any advertising without its written permission.) N( *) N( * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER) N( * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE) N( * FOR ANY PARTICULAR PURPOSE.  The software is provided "as is") N( *  without express or implied warranty of any kind. These notices must) N( * be retained in any copies of any part of this software.) N( */) N() N(#include "lauc-scheduler.h") N() N(/* Construct a new Lauc Scheduler object with the provided control and data */) N(LaucScheduler::LaucScheduler\( u_int ncc, u_int ndc, u_int maxChannels \) {) N(    alloc\( ncc, ndc, maxChannels \);) N(}) N() N(/* alloc method */) N(void LaucScheduler::alloc\( u_int ncc, u_int ndc, u_int maxChannels \) {) N(    assert\( \( ncc > 0 \) && \( ndc > 0 \) && \( maxChannels > 0 \) \);) N(    assert\( \(ncc + ndc\) == maxChannels \);) N() N(    ncc_ = ncc;) N(    ndc_ = ndc;) N(    maxChannels_ = maxChannels;) N() N() N(stdin) (Page 8/22) (Feb 24, 04 9:54) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (4/11) (Tuesday February 24, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (9-10) 5%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(lauc-scheduler.cc) K(  Aug 27 11:32 2003                        Page:   7) p n() N(    unschTime_ = new double[maxChannels];) N(    startTime_ = new double[maxChannels];) N(    endTime_ = new double[maxChannels];) N() N(    memset\( unschTime_, 0, maxChannels * sizeof\( double \) \);) N(    memset\( startTime_, 0, maxChannels * sizeof\( double \) \);) N(    memset\( endTime_, 0, maxChannels * sizeof\( double \)  \);) N(}) N() N(/* Schedule a control channel at the proposed schedule time and duration */) N(Schedule LaucScheduler::schedControl\( double schedTime, double schedDur \) {) N(    Schedule result;) N(    double diffTime = HUGE_VAL;) N() N(    assert\( \( schedTime >= 0. \) && \( schedDur >= 0. \) \);) N(    assert\( \( ncc_ > 0 \) && \( ndc_ > 0 \) && \( \( ncc_ + ndc_ \) == maxChannels_ \) ) N(\);) N() N(    for\( u_int i = 0; i < ncc_; i++ \){) N(        if\( schedTime >= unschTime_[i] \)) N(        if\( \( schedTime - unschTime_[i] \) < diffTime \) {) N(            diffTime = schedTime - unschTime_[i];) N(            result.channel\(\) = i;) N(            result.startTime\(\) = schedTime;) N(        }) N(    }) N(    int ch = result.channel\(\);) N() N(    if\( ch >= 0 \)) N(        unschTime_[ch] = schedTime + schedDur;) N(    return result;) N(}) N() N() N(/* Schedule a data channel at the proposed schedule time and duration */) N(Schedule LaucScheduler::schedData\( double schedTime, double schedDur \){) N() N(    // make sure the sched duration is greater than 0.) N(    assert\( \( schedTime >= 0. \) && \( schedDur > 0. \) \);) N(    assert\( \( ncc_ > 0 \) && \( ndc_ > 0 \) && \( \( ncc_ + ndc_ \) == maxChannels_ \) ) N(\);) N() N(    Schedule result = search\( schedTime, schedDur \);) N() N(    int ch = result.channel\(\);) N(    if\( ch >= 0 \)) N(        update\( ch, result.startTime\(\), schedDur \);) N() N(    return result;) N(}) N() N() N(// search the scheduler and the voids for an appropriate schedule) N(Schedule LaucScheduler::search\( double schedTime, double schedDur \) {) N(    Schedule result;) N(    double   diffTime = HUGE_VAL;) N() N(    for\( u_int i = ncc_; i < maxChannels_; i++ \) {) N() N(stdin) (Page 9/22) (Feb 24, 04 9:54) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(lauc-scheduler.cc) K(  Aug 27 11:32 2003                        Page:   8) p n() N(        // try to schedule in a void) N(        if\( schedTime >= startTime_[i] \)) N(        if\( \( endTime_[i] - schedTime \) >= schedDur \)) N(        if\( \( schedTime - startTime_[i] \) < diffTime \) {) N(            diffTime = schedTime - startTime_[i];) N(            result.channel\(\) = i;) N(            result.startTime\(\) = schedTime;) N(        }) N(        // try to schedule after the void) N(        if\( schedTime >= unschTime_[i] \)) N(        if\( \( schedTime - unschTime_[i] \) < diffTime \) {) N(            diffTime = schedTime - unschTime_[i];) N(            result.channel\(\) = i;) N(            result.startTime\(\) = schedTime;) N(        }) N(    }) N(    return \(result\);) N(}) N() N(// update the $channel information) N(void LaucScheduler::update\( u_int channel, double schedTime, double schedDur \)) N({) N(    if\( schedTime >= unschTime_[channel] \) {) N(        startTime_[channel] = unschTime_[channel];) N(        unschTime_[channel] = schedTime + schedDur;) N(        endTime_[channel] = schedTime;) N(    } else {) N(        // scheduled in the void) N(        // i.e sched_time < unsch_time[channel]) N(        startTime_[channel] = schedTime + schedDur;) N(    }) N(}) N() N() N() N(/* Diagnostic method */) N(void LaucScheduler::printChInfo\( u_int channel \) {) N(    assert\( channel < maxChannels_ \);) N() N(    cout << "Channel " << channel << " unscheduled time: " <<) N(         unschTime_[channel] << " start time: " << startTime_[channel] <<) N(         " end time: " << endTime_[channel] << endl;) N(}) N() N() N(stdin) (Page 10/22) (Feb 24, 04 9:54) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (5/11) (Tuesday February 24, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (11-12) 6%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(scheduler-group.cc) K(  Aug 27 11:32 2003                       Page:   9) p n() N(/* Copyright \(c\) University of Maryland, Baltimore County, 2003.) N( * Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam.) N( *) N( * This software is developed at the University of Maryland, Baltimore County un) N(der) N( * grants from Cisco Systems Inc and the University of Maryland, Baltimore Count) N(y.) N( *) N( * Permission to use, copy, modify, and distribute this software and its) N( * documentation in source and binary forms for non-commercial purposes) N( * and without fee is hereby granted, provided that the above copyright) N( * notice appear in all copies and that both the copyright notice and) N( * this permission notice appear in supporting documentation. and that) N( * any documentation, advertising materials, and other materials related) N( * to such distribution and use acknowledge that the software was) N( * developed by the University of Maryland, Baltimore County.  The name of) N( * the University may not be used to endorse or promote products derived from) N( * this software without specific prior written permission.) N( *) N( * Copyright \(C\) 2000-2003 Washington State University. All rights reserved.) N( * This software was originally developed at Alcatel USA and subsequently modifi) N(ed) N( * at Washington State University, Pullman, WA  through research work which was) N( * supported by Alcatel USA, Inc and Cisco Systems Inc.) N() N( * The  following notice is in adherence to the Washington State University) N( * copyright policy follows.) N( *) N( * License is granted to copy, to use, and to make and to use derivative) N( * works for research and evaluation purposes, provided that Washington) N( * State University is acknowledged in all documentation pertaining to any such) N( * copy or derivative work. Washington State University grants no other) N( * licenses expressed or implied. The Washington State University name) N( * should not be used in any advertising without its written permission.) N( *) N( * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER) N( * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE) N( * FOR ANY PARTICULAR PURPOSE.  The software is provided "as is") N( *  without express or implied warranty of any kind. These notices must) N( * be retained in any copies of any part of this software.) N( */) N() N(#include "scheduler-group.h") N() N() N(Scheduler_group::Scheduler_group\(\)  {) N(    currsize_ = 0;) N(    slot_ = NULL;) N(    add_slots\( default_size \);) N(}) N() N(Scheduler_group::~Scheduler_group\(\) {) N(    delete[] slot_;) N(}) N() N(// install the NsObject at the specified slot) N(void Scheduler_group::install\( LaucScheduler *obj, u_int slot \) {) N(    if\( slot >= currsize_ \)) N() N(stdin) (Page 11/22) (Feb 24, 04 9:54) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(scheduler-group.cc) K(  Aug 27 11:32 2003                       Page:  10) p n() N(        add_slots\( slot + 1 \);) N(    slot_[slot] = obj;) N(}) N() N(// install NsObject ptr at the next available slot) N(void Scheduler_group::install\( LaucScheduler *obj \) {) N(    install\( obj, getNext\(\) \);) N(}) N() N(// return the object specified by the slot number or NULL) N(LaucScheduler* Scheduler_group::getObject\( u_int slot \) {) N(    if\( slot >= currsize_ \)) N(        return NULL;) N(    if\( slot_[slot] == 0  \)) N(        return NULL;) N(    return \( slot_[slot] \);) N(}) N() N(// search for a base scheduler based upon its dest-node-id) N(LaucScheduler* Scheduler_group::search\( u_int dest_id \) {) N(    LaucScheduler *result = NULL;) N() N(    for\( u_int i = 0; i < currsize_; i++ \) {) N(        if\( slot_[i] != NULL \)) N(        if\( slot_[i] != 0 \) {) N(            result = slot_[i];) N(            if\( result->destNodeId\(\) == dest_id \)) N(                return result;) N(            result = NULL;) N(        }) N(    }) N(    return result;) N(}) N() N(// protected methods) N(void Scheduler_group::add_slots\( u_int nslots \) {) N(    assert\( nslots > 0 \);) N() N(    int n = currsize_;) N(    currsize_ += nslots;) N(    LaucScheduler** old = slot_;) N() N(    slot_ = new LaucScheduler*[currsize_];) N(    memset\( slot_, 0, currsize_ * sizeof\( LaucScheduler* \) \);) N() N(    if\( old != NULL \)  {) N(        for\( int i = 0; i < n ; i++ \)) N(            slot_[i] = old[i];) N(        delete[] old;) N(    }) N(}) N() N(u_int Scheduler_group::getNext\(\) {) N() N(    for\( u_int i = 0; i < currsize_; i++ \)) N(        if\( slot_[i] == 0 \)) N() N(stdin) (Page 12/22) (Feb 24, 04 9:54) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (6/11) (Tuesday February 24, 2004) footerend % of iso1dictpagesave restoreshowpage%%Page: (13-14) 7%%BeginPageSetup/pagesave save defsh 0 translate 90 rotate%%EndPageSetupiso1dict begingsavellx lly 12 add translate/v 0 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(scheduler-group.cc) K(  Aug 27 11:32 2003                       Page:  11) p n() N(            return \(i\);) N() N(    // oops ... no more slots available add default_size) N(    // more slots to the slot group and make the function) N(    // call again) N(    add_slots\( default_size \);) N(    return \( getNext\(\) \);) N(}) N() N() N(// diagnostic method) N(void Scheduler_group::printInfo\(\){) N(    for\( u_int i = 0; i < currsize_; i++ \) {) N(        LaucScheduler *sc = getObject\( i \);) N(        if\( sc == NULL \) {) N(            cout << "LaucScheduler at slot " << i << " is NULL " << endl;) N(        }) N(        else {) N(            cout << "Destination node id is: "<< sc->destNodeId\(\) << endl;) N(            for\( u_int j = 0; j < sc->maxChannels\(\); j++ \)) N(                sc->printChInfo\( j \);) N(        }) N(        cout << "printed information for laucscheduler at slot" << i << endl;) N(    }) N(}) N() N() N(/*) N(void main\(\) {) N(    Scheduler_group sg;) N() N(    NsObject *p = new NsObject;) N(    p->setId\( 9000 \);) N(    sg.install\( p, 3 \);) N() N(    for\( int i = 0; i < 13; i++ \)   {) N(        NsObject *n = new NsObject;) N(        n->setId\( i \);) N(        sg.install\( n \);) N(    }) N() N(    for\( int i = 0; i < 13; i++ \)   {) N(        NsObject *n = sg.getObject\( i \);) N(        cout << "id" << n->getId\(\) << endl;) N(    }) N() N() N(} */) N() N() N(stdin) (Page 13/22) (Feb 24, 04 9:54) titleborder/v 1 store/x0 x v get 3.362408 add sx cw mul add store/y0 y v get bfs th add sub storex0 y0 moveto(Table.h) K(  Aug 27 11:32 2003                                  Page:  12) p n() N(/* Copyright \(c\) University of Maryland, Baltimore County, 2003.) N( * Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam.) N( *) N( * This software is developed at the University of Maryland, Baltimore County un) N(der) N( * grants from Cisco Systems Inc and the University of Maryland, Baltimore Count) N(y.) N( *) N( * Permission to use, copy, modify, and distribute this software and its) N( * documentation in source and binary forms for non-commercial purposes) N( * and without fee is hereby granted, provided that the above copyright) N( * notice appear in all copies and that both the copyright notice and) N( * this permission notice appear in supporting documentation. and that) N( * any documentation, advertising materials, and other materials related) N( * to such distribution and use acknowledge that the software was) N( * developed by the University of Maryland, Baltimore County.  The name of) N( * the University may not be used to endorse or promote products derived from) N( * this software without specific prior written permission.) N( *) N( * Copyright \(C\) 2000-2003 Washington State University. All rights reserved.) N( * This software was originally developed at Alcatel USA and subsequently modifi) N(ed) N( * at Washington State University, Pullman, WA  through research work which was) N( * supported by Alcatel USA, Inc and Cisco Systems Inc.) N() N( * The  following notice is in adherence to the Washington State University) N( * copyright policy follows.) N( *) N( * License is granted to copy, to use, and to make and to use derivative) N( * works for research and evaluation purposes, provided that Washington) N( * State University is acknowledged in all documentation pertaining to any such) N( * copy or derivative work. Washington State University grants no other) N( * licenses expressed or implied. The Washington State University name) N( * should not be used in any advertising without its written permission.) N( *) N( * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER) N( * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE) N( * FOR ANY PARTICULAR PURPOSE.  The software is provided "as is") N( *  without express or implied warranty of any kind. These notices must) N( * be retained in any copies of any part of this software.) N( */) N(#ifndef Table_h) N(#define Table_h) N() N(/* Implementation of a lookup switch */) N() N(using namespace std;) N() N(#include <cstdlib>) N(#include <iostream>) N(#include <map>) N(#include <cstdio>) N(#include "../debug.h") N() N(/* A single entry in the lookup switch */) N(class HashEntry) N({) N(    public:) N() N(stdin) (Page 14/22) (Feb 24, 04 9:54) titlebordergrestore(Printed by U-GMGPC2\\Geoffrey M. Garner) rhead(stdin) (7/11) (Tuesday February 24, 2004) footer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -