void CBkmrkExtendedProperties::TransLoadL()
{
    CBkmrkProperties::TransLoadL();

    TUint32 indexBase = IndexBase();
    HBufC8* buffer = HBufC8::NewL(Bookmark::KMaxDataLength);
    CleanupStack::PushL(buffer);
    TPtr8 bufPtr = buffer->Des();
    if (!iAuthentication)
    {
        // Create an empty authentication object
        iAuthentication = CAuthentication::NewL(KNullDesC8, KNullDesC8);
    }
    User::LeaveIfError(iRepository->Get(indexBase + KBkmrkAuthNameIndex, bufPtr));
    iAuthentication->SetNameL(bufPtr);
    User::LeaveIfError(iRepository->Get(indexBase + KBkmrkAuthPasswordIndex, bufPtr));
    iAuthentication->SetPasswordL(bufPtr);
    TInt method;
    User::LeaveIfError(iRepository->Get(indexBase + KBkmrkAuthMethodIndex, method));
    iAuthentication->SetMethod(static_cast<CAuthentication::TMethod>(method));
    CleanupStack::PopAndDestroy(buffer);

    TInt retVal;
    User::LeaveIfError(iRepository->Get(indexBase + KBkmrkProxyIndex, retVal));
    iProxy = static_cast<TUint32>(retVal);
    User::LeaveIfError(iRepository->Get(indexBase + KBkmrkNapIndex, retVal));
    iNap = static_cast<TUint32>(retVal);
    SetClean();
}
void CBkmrkExtendedProperties::TransSaveL()
{
    CBkmrkProperties::TransSaveL();
    TUint32 indexBase = IndexBase();
    iRepository->Set(indexBase + KBkmrkAuthNameIndex, AuthenticationL().Name());
    iRepository->Set(indexBase + KBkmrkAuthPasswordIndex, AuthenticationL().Password());
    iRepository->Set(indexBase + KBkmrkAuthMethodIndex, AuthenticationL().Method());
    iRepository->Set(indexBase + KBkmrkProxyIndex, static_cast<TInt>(iProxy));
    iRepository->Set(indexBase + KBkmrkNapIndex, static_cast<TInt>(iNap));
}
void CBkmrkExtendedProperties::TransRemoveL()
{
    CBkmrkProperties::TransRemoveL();

    TUint32 indexBase = IndexBase();
    iRepository->Delete(indexBase + KBkmrkAuthNameIndex);
    iRepository->Delete(indexBase + KBkmrkAuthPasswordIndex);
    iRepository->Delete(indexBase + KBkmrkAuthMethodIndex);
    iRepository->Delete(indexBase + KBkmrkProxyIndex);
    iRepository->Delete(indexBase + KBkmrkNapIndex);
    iCustomProperties->TransRemoveL();
}
Ejemplo n.º 4
0
void CBkmrkProperties::TransSaveL()
	{
	SetModified ();
	
	TUint32 indexBase = IndexBase();
	TUint32 timeLo = I64LOW(iLastModified.Int64());
	TUint32 timeHi = I64HIGH(iLastModified.Int64());
	iRepository->Set(indexBase + KBkmrkLastModifiedLoIndex, static_cast<TInt>(timeLo));
	iRepository->Set(indexBase + KBkmrkLastModifiedHiIndex, static_cast<TInt>(timeHi));
	iRepository->Set(indexBase + KCmnDescriptionIndex, Description());
	iRepository->Set(indexBase + KCmnIconIndex, static_cast<TInt>(iIconId));
	iCustomProperties->TransSaveL();
	}
Ejemplo n.º 5
0
void CBkmrkProperties::TransRemoveL()
	{
	TUint32 indexBase = IndexBase();
	iRepository->Delete(indexBase + KCmnDescriptionIndex);
	iRepository->Delete(indexBase + KCmnIconIndex);
	TInt low  = 0;
	TInt err = iRepository->Get( indexBase + KBkmrkLastModifiedLoIndex, low );
	if ( err == KErrNone )
		{
		iRepository->Delete(indexBase + KBkmrkLastModifiedLoIndex);
		iRepository->Delete(indexBase + KBkmrkLastModifiedHiIndex);			
		}
	iCustomProperties->TransRemoveL();
	}
Ejemplo n.º 6
0
void CRepositoryAccessor::CommitL()
	{
	TUint32 indexBase = IndexBase();

	switch (iStatus)
		{
	case EStatusCreating:
		TransactionL(ETransNew);
		break;
	case EStatusDirty:
		TransactionL(ETransSave);
		break;
	case EStatusDeleted:
		TransactionL(ETransRemove);
		break;
	case EStatusClean:
	default:
		// Do nothing
		break;
		}
	iStatus = EStatusClean;
	}
Ejemplo n.º 7
0
void CBkmrkProperties::TransLoadL()
	{
	TUint32 indexBase = IndexBase();
	TInt low  = 0;
	TInt high = 0;
	TInt err = iRepository->Get( indexBase + KBkmrkLastModifiedLoIndex, low );
	if ( err == KErrNone )
		{
		User::LeaveIfError(iRepository->Get(indexBase + KBkmrkLastModifiedHiIndex, high));					
		TUint32 timeLo = static_cast<TUint32>(low);
		TUint32 timeHi = static_cast<TUint32>(high);
		TInt64 time = MAKE_TINT64(timeHi, timeLo);
		iLastModified = time;
		}
	else
		{
		// Set the time as 1st January 1970 midnight.
		TDateTime dt ( 1970, EJanuary, 1, 0, 0, 0, 0 );
		iLastModified = TTime ( dt );
		}
		
	HBufC* descBuffer = HBufC::NewLC(Bookmark::KMaxDescriptorLength);
	TPtr descPtr = descBuffer->Des();
	User::LeaveIfError(iRepository->Get(indexBase + KCmnDescriptionIndex, descPtr));
	delete iDescription;
	iDescription = NULL;
	iDescription = descPtr.AllocL();
	CleanupStack::PopAndDestroy(descBuffer);
	
	TInt retVal;
	User::LeaveIfError(iRepository->Get(indexBase + KCmnIconIndex, retVal));
	iIconId = static_cast<Bookmark::TAttachmentId>(retVal);
	
	iCustomProperties->TransLoadL();
	SetClean();
	}
Ejemplo n.º 8
0
//=============================================================================
Epetra_Map * Epetra_Map::RemoveEmptyProcesses() const
{
#ifdef HAVE_MPI
  const Epetra_MpiComm * MpiComm = dynamic_cast<const Epetra_MpiComm*>(&Comm());

  // If the Comm isn't MPI, just treat this as a copy constructor
  if(!MpiComm) return new Epetra_Map(*this);

  MPI_Comm NewComm,MyMPIComm = MpiComm->Comm();

  // Create the new communicator.  MPI_Comm_split returns a valid
  // communicator on all processes.  On processes where color == MPI_UNDEFINED,
  // ignore the result.  Passing key == 0 tells MPI to order the
  // processes in the new communicator by their rank in the old
  // communicator.
  const int color = (NumMyElements() == 0) ? MPI_UNDEFINED : 1;

  // MPI_Comm_split must be called collectively over the original
  // communicator.  We can't just call it on processes with color
  // one, even though we will ignore its result on processes with
  // color zero.
  int rv = MPI_Comm_split(MyMPIComm,color,0,&NewComm);
  if(rv!=MPI_SUCCESS) throw ReportError("Epetra_Map::RemoveEmptyProcesses: MPI_Comm_split failed.",-1);

  if(color == MPI_UNDEFINED)
    return 0; // We're not in the new map
  else {
    Epetra_MpiComm * NewEpetraComm = new Epetra_MpiComm(NewComm);

    // Use the copy constructor for a new map, but basically because it does nothing useful
    Epetra_Map * NewMap = new Epetra_Map(*this);

    // Get rid of the old BlockMapData, now make a new one from scratch...
    NewMap->CleanupData();
    if(GlobalIndicesInt()) {
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
      NewMap->BlockMapData_ = new Epetra_BlockMapData(NumGlobalElements(),0,IndexBase(),*NewEpetraComm,false);
#endif
    }
    else {
#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
      NewMap->BlockMapData_ = new Epetra_BlockMapData(NumGlobalElements64(),0,IndexBase64(),*NewEpetraComm,true);
#endif
    }

    // Now copy all of the relevent bits of BlockMapData...
    //    NewMap->BlockMapData_->Comm_                    = NewEpetraComm;
    NewMap->BlockMapData_->LID_                     = BlockMapData_->LID_;
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
    NewMap->BlockMapData_->MyGlobalElements_int_    = BlockMapData_->MyGlobalElements_int_;
#endif
#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
    NewMap->BlockMapData_->MyGlobalElements_LL_     = BlockMapData_->MyGlobalElements_LL_;
#endif
    NewMap->BlockMapData_->FirstPointInElementList_ = BlockMapData_->FirstPointInElementList_;
    NewMap->BlockMapData_->ElementSizeList_         = BlockMapData_->ElementSizeList_;
    NewMap->BlockMapData_->PointToElementList_      = BlockMapData_->PointToElementList_;

    NewMap->BlockMapData_->NumGlobalElements_       = BlockMapData_->NumGlobalElements_;
    NewMap->BlockMapData_->NumMyElements_           = BlockMapData_->NumMyElements_;
    NewMap->BlockMapData_->IndexBase_               = BlockMapData_->IndexBase_;
    NewMap->BlockMapData_->ElementSize_             = BlockMapData_->ElementSize_;
    NewMap->BlockMapData_->MinMyElementSize_        = BlockMapData_->MinMyElementSize_;
    NewMap->BlockMapData_->MaxMyElementSize_        = BlockMapData_->MaxMyElementSize_;
    NewMap->BlockMapData_->MinElementSize_          = BlockMapData_->MinElementSize_;
    NewMap->BlockMapData_->MaxElementSize_          = BlockMapData_->MaxElementSize_;
    NewMap->BlockMapData_->MinAllGID_               = BlockMapData_->MinAllGID_;
    NewMap->BlockMapData_->MaxAllGID_               = BlockMapData_->MaxAllGID_;
    NewMap->BlockMapData_->MinMyGID_                = BlockMapData_->MinMyGID_;
    NewMap->BlockMapData_->MaxMyGID_                = BlockMapData_->MaxMyGID_;
    NewMap->BlockMapData_->MinLID_                  = BlockMapData_->MinLID_;
    NewMap->BlockMapData_->MaxLID_                  = BlockMapData_->MaxLID_;
    NewMap->BlockMapData_->NumGlobalPoints_         = BlockMapData_->NumGlobalPoints_;
    NewMap->BlockMapData_->NumMyPoints_             = BlockMapData_->NumMyPoints_;
    NewMap->BlockMapData_->ConstantElementSize_     = BlockMapData_->ConstantElementSize_;
    NewMap->BlockMapData_->LinearMap_               = BlockMapData_->LinearMap_;
    NewMap->BlockMapData_->DistributedGlobal_       = NewEpetraComm->NumProc()==1 ? false : BlockMapData_->DistributedGlobal_;
    NewMap->BlockMapData_->OneToOneIsDetermined_    = BlockMapData_->OneToOneIsDetermined_;
    NewMap->BlockMapData_->OneToOne_                = BlockMapData_->OneToOne_;
    NewMap->BlockMapData_->GlobalIndicesInt_        = BlockMapData_->GlobalIndicesInt_;
    NewMap->BlockMapData_->GlobalIndicesLongLong_   = BlockMapData_->GlobalIndicesLongLong_;
    NewMap->BlockMapData_->LastContiguousGID_       = BlockMapData_->LastContiguousGID_;
    NewMap->BlockMapData_->LastContiguousGIDLoc_    = BlockMapData_->LastContiguousGIDLoc_;
    NewMap->BlockMapData_->LIDHash_                 = BlockMapData_->LIDHash_ ? new Epetra_HashTable<int>(*BlockMapData_->LIDHash_) : 0;

    // Delay directory construction
    NewMap->BlockMapData_->Directory_               = 0;

    // Cleanup
    delete NewEpetraComm;

    return NewMap;
  }
#else
    // MPI isn't compiled, so just treat this as a copy constructor
    return new Epetra_Map(*this);
#endif
}
Ejemplo n.º 9
0
void CBkmrkProperties::ConstructL()
	{
	CPropertyReg::TPropertyGroup type = CPropertyReg::EGroupBookmark;
	if (iParent.Type() == Bookmark::ETypeFolder)
		{
		type = CPropertyReg::EGroupFolder;
		}
	iCustomProperties = CPropertyList::NewL(*iRepository, iDatabase.PropertyRegister(), type, IndexBase() + KBkmrkCusPropertyStart);
	}
Ejemplo n.º 10
0
//==============================================================================
void Epetra_BlockMap::Print(ostream & os) const
{
  int * FirstPointInElementList1 = 0;
  int * ElementSizeList1 = 0;
  if (!ConstantElementSize()) {
    FirstPointInElementList1 = FirstPointInElementList();
    ElementSizeList1 = ElementSizeList();
  }
  int MyPID = Comm().MyPID();
  int NumProc = Comm().NumProc();
  
  for (int iproc = 0; iproc < NumProc; iproc++) {
    if (MyPID == iproc) {
      if (MyPID == 0) {
  os <<  "\nNumber of Global Elements  = "; os << NumGlobalElements64(); os << endl;
  os <<    "Number of Global Points    = "; os << NumGlobalPoints64(); os << endl;
  os <<    "Maximum of all GIDs        = "; os << MaxAllGID64(); os << endl;
  os <<    "Minimum of all GIDs        = "; os << MinAllGID64(); os << endl;
  os <<    "Index Base                 = "; os << IndexBase(); os << endl;
  if (ConstantElementSize())
    os <<  "Constant Element Size      = "; os << ElementSize(); os << endl;
      }
      os << endl;
      
      os <<    "Number of Local Elements   = "; os << NumMyElements(); os << endl;
      os <<    "Number of Local Points     = "; os << NumMyPoints(); os << endl;
      os <<    "Maximum of my GIDs         = "; os << MaxMyGID64(); os << endl;
      os <<    "Minimum of my GIDs         = "; os << MinMyGID64(); os << endl;
      os << endl;
      
      os.width(14);
      os <<  "     MyPID"; os << "    ";
      os.width(14);
      os <<  "       Local Index "; os << " ";
      os.width(14);
      os <<  "      Global Index "; os << " ";
      if (!ConstantElementSize()) {
  os.width(14);
  os <<" FirstPointInElement "; os << " ";
  os.width(14);
  os <<"   ElementSize "; os << " ";
      }
      os << endl;
      
      for (int i = 0; i < NumMyElements(); i++) {
  os.width(14);
  os <<  MyPID; os << "    ";
  os.width(14);
  os <<  i; os << "    ";
  os.width(14);

  if(BlockMapData_->GlobalIndicesLongLong_)
  {
#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
    long long * MyGlobalElements1 = MyGlobalElements64();
    os <<  MyGlobalElements1[i]; os << "    ";
#else
    throw ReportError("Epetra_BlockMap::Print: ERROR, GlobalIndicesLongLong but no API for it.",-1);
#endif
  }
  else if(BlockMapData_->GlobalIndicesInt_)
  {
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
    int * MyGlobalElements1 = MyGlobalElements();
    os <<  MyGlobalElements1[i]; os << "    ";
#else
    throw ReportError("Epetra_BlockMap::Print: ERROR, no GlobalIndicesLongLong but no API for it.",-1);
#endif
  }

  if (!ConstantElementSize()) {    
    os.width(14);
    os << FirstPointInElementList1[i]; os << "    ";
    os.width(14);
    os << ElementSizeList1[i]; os << "    ";
  }
  os << endl;
      }
      
      os << flush;
      
    }
    // Do a few global ops to give I/O a chance to complete
    Comm().Barrier();
    Comm().Barrier();
    Comm().Barrier();
  }
  return;
}